r348: fix linefeed problem
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 2 Jan 2001 16:02:13 +0000 (16:02 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 2 Jan 2001 16:02:13 +0000 (16:02 +0000)
41 files changed:
configure
include/array2dfile.h
include/ct.h
include/ctsupport.h
include/ezplot.h
include/fnetorderstream.h
include/fourier.h
include/hashtable.h
include/imagefile.h
include/msvc_compat.h
include/phantom.h
include/plotfile.h
include/pol.h
include/procsignal.h
include/sgp.h
libctgraphics/ezset.cpp
libctgraphics/pol.cpp
libctgraphics/sgp.cpp
libctgraphics/transformmatrix.cpp
libctsim/array2dfile.cpp
libctsim/backprojectors.cpp
libctsim/filter.cpp
libctsim/fourier.cpp
libctsim/imagefile.cpp
libctsim/phantom.cpp
libctsim/procsignal.cpp
libctsim/projections.cpp
libctsim/reconstruct.cpp
libctsupport/clip.cpp
libctsupport/fnetorderstream.cpp
libctsupport/hashtable.cpp
libctsupport/mathfuncs.cpp
libctsupport/msvc.cpp
libctsupport/plotfile.cpp
libctsupport/syserror.cpp
libctsupport/xform.cpp
src/ctsim.cpp
src/dialogs.cpp
src/dlgprojections.cpp
src/dlgreconstruct.cpp
src/docs.cpp

index fc93465eb00ddaaf5c65eb3fe54bcc485773dd18..663e7f5e3fbd9486dcf6c5d30c413f9f37a1f693 100755 (executable)
--- a/configure
+++ b/configure
@@ -715,7 +715,7 @@ fi
 
 PACKAGE=ctsim
 
-VERSION=3.0.0alpha1
+VERSION=3.0.0alpha3
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
index 79ae2f26f74b1ea476f82ea4bb3ab4cddfd50b1d..b49e04a25ed80c89d5d9b90d459d6a0087dde9ca 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: array2dfile.h,v 1.17 2001/01/02 07:47:36 kevin Exp $
+**  $Id: array2dfile.h,v 1.18 2001/01/02 16:02:12 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 <sys/types.h>
 #include <cstring>
-#include <string>\r
+#include <string>
 #include <iosfwd>
-#include <iomanip>\r
-#include <fstream>\r
-#include <iostream>\r
+#include <iomanip>
+#include <fstream>
+#include <iostream>
 #include <vector>
 #include "ctsupport.h"
 #include "fnetorderstream.h"
@@ -89,8 +89,8 @@ public:
     const std::string& getDateString () const;
 
     void print (std::ostream& os) const;
-    void printBrief (std::ostream& os) const;\r
-    void printBrief (std::ostringstream& os) const;\r
+    void printBrief (std::ostream& os) const;
+    void printBrief (std::ostringstream& os) const;
 
     Array2dFileLabel (const Array2dFileLabel& rhs);
 
@@ -127,12 +127,12 @@ public:
     PIXEL_FLOAT32 = 7,
     PIXEL_FLOAT64 = 8,
   };
-\r
-  enum {\r
-    DATA_TYPE_INVALID = 0,\r
-    DATA_TYPE_REAL,\r
-    DATA_TYPE_COMPLEX,\r
-  };\r
+
+  enum {
+    DATA_TYPE_INVALID = 0,
+    DATA_TYPE_REAL,
+    DATA_TYPE_COMPLEX,
+  };
 
   Array2dFile (int nx, int ny, int pixelSize, int pixelFormat = PIXEL_INVALID, int dataType = DATA_TYPE_REAL);
   Array2dFile (void);
@@ -166,26 +166,26 @@ public:
 
   kuint32 ny (void) const
       { return m_ny; }
-\r
-  bool isComplex() const\r
-  { return m_dataType == DATA_TYPE_COMPLEX; }\r
-\r
-  bool isReal() const\r
-  { return m_dataType == DATA_TYPE_REAL; }\r
-\r
-  int dataType () const\r
-  { return static_cast<int>(m_dataType); }\r
-\r
-  void setDataType (int dataType)\r
-  { m_dataType = dataType; }\r
+
+  bool isComplex() const
+  { return m_dataType == DATA_TYPE_COMPLEX; }
+
+  bool isReal() const
+  { return m_dataType == DATA_TYPE_REAL; }
+
+  int dataType () const
+  { return static_cast<int>(m_dataType); }
+
+  void setDataType (int dataType)
+  { m_dataType = dataType; }
 
   void setAxisIncrement (double axisIncX, double axisIncY);
 
-  bool reallocRealToComplex ();\r
-\r
-  bool reallocComplexToReal ();\r
+  bool reallocRealToComplex ();
+
+  bool reallocComplexToReal ();
 
-  void getPixelValueRange (double& pvmin, double& pvmax) const;\r
+  void getPixelValueRange (double& pvmin, double& pvmax) const;
   void setAxisExtent (double minX, double maxX, double minY, double maxY);
       
   void doPixelOffsetScale (double offset, double scale);
@@ -203,12 +203,12 @@ public:
   const std::string& getFilename (void) const 
       {  return m_filename; }
 
-  void printLabels (std::ostream& os) const;\r
-  void printLabelsBrief (std::ostream& os) const;\r
-  void printLabelsBrief (std::ostringstream& os) const;\r
-\r
-  unsigned int nLabels() const\r
-  { return m_labels.size(); }\r
+  void printLabels (std::ostream& os) const;
+  void printLabelsBrief (std::ostream& os) const;
+  void printLabelsBrief (std::ostringstream& os) const;
+
+  unsigned int nLabels() const
+  { return m_labels.size(); }
 
   typedef std::vector<Array2dFileLabel*>::iterator labelIterator;
   typedef std::vector<Array2dFileLabel*>::const_iterator constLabelIterator;
@@ -231,10 +231,10 @@ public:
   kuint32 m_ny;
   kuint32 m_arraySize;
   labelContainer m_labels;
-  kuint16 m_numFileLabels;\r
+  kuint16 m_numFileLabels;
   kuint16 m_dataType;
   unsigned char** m_arrayData;
-  unsigned char** m_imaginaryArrayData;\r
+  unsigned char** m_imaginaryArrayData;
 
 private:
   void init (void);
@@ -255,9 +255,9 @@ private:
 
   void allocArrays ();
   void freeArrays ();
-\r
-  void allocArray (unsigned char**& rppData);\r
-  void freeArray (unsigned char**& rppData);\r
+
+  void allocArray (unsigned char**& rppData);
+  void freeArray (unsigned char**& rppData);
 
   Array2dFile (const Array2dFile& rhs);        // copy constructor
   Array2dFile& operator= (const Array2dFile&); // assignment operator
index b618130ec6d152772bd23b2baece82a430727e8c..98425a16aae164c22b2f2b4c52aa5861bf729c15 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ct.h,v 1.48 2001/01/02 05:34:57 kevin Exp $
+**  $Id: ct.h,v 1.49 2001/01/02 16:02:12 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
@@ -35,7 +35,7 @@
 #ifdef HAVE_CONFIG_H
   #include <config.h>
 #endif
-\r
+
 #define HAVE_ANSI_CPP 1
 #ifdef HAVE_ANSI_CPP
 #include <complex>
 #include <cstddef>
 #include <cstdarg>
 #include <cstdlib>
-\r
-#if defined(MSVC) || HAVE_SSTREAM\r
+
+#if defined(MSVC) || HAVE_SSTREAM
 #include <sstream>
-#else\r
+#else
 #include <sstream_subst>
-#endif\r
-\r
+#endif
+
 #include <fstream>
 #include <iostream>
-#include <string>\r
+#include <string>
 #include <iterator>
 #include <algorithm>
 #include <exception>
@@ -170,12 +170,12 @@ extern "C" {
 #include "phantom.h"
 #include "scanner.h"
 #include "backprojectors.h"
-#include "filter.h"\r
+#include "filter.h"
 #include "fourier.h"
 #include "procsignal.h"
 #include "projections.h"
 #include "reconstruct.h"
-#include "plotfile.h"\r
+#include "plotfile.h"
 #include "trace.h"
 
 
index b4063e30a56eccb2f26f47b2c38d318e5059ff28..d843a085b9cb899eb3936e42c1711f7c2d9fb723 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsupport.h,v 1.21 2001/01/02 07:47:36 kevin Exp $
+**  $Id: ctsupport.h,v 1.22 2001/01/02 16:02:12 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
 #include <cstdio>
 #include <cstdlib>
 #include <cstring>
-#include <cstdarg>\r
+#include <cstdarg>
 #include <string>
-#include <vector>\r
-#include <algorithm>\r
+#include <vector>
+#include <algorithm>
 
-#if defined(MSVC) || HAVE_SSTREAM\r
+#if defined(MSVC) || HAVE_SSTREAM
 #include <sstream>
-#else\r
+#else
 #include <sstream_subst>
-#endif\r
+#endif
 
 #define TRUE   1
 #define FALSE  0
@@ -71,7 +71,7 @@
 
 /*----------------------------------------------------------------------*/
 
-#define ERR_TRACE -1\r
+#define ERR_TRACE -1
 #define ERR_WARNING    0
 #define ERR_SEVERE     1
 #define ERR_FATAL      2
@@ -190,27 +190,27 @@ convertRadiansToDegrees (double x)
 template<class T>
 inline T nearest (double x)
 { return (x > 0 ? static_cast<T>(x+0.5) : static_cast<T>(x-0.5)); }
-\r
-inline bool isEven (int n)\r
-{ return (n % 2) == 0; }\r
-\r
-inline bool isOdd (int n)\r
-{ return (n % 2) != 0; }\r
-\r
-#if 0\r
-inline bool isEven (long n)\r
-{ return (n % 2) == 0; }\r
-\r
-inline bool isOdd (long n)\r
-{ return (n % 2) != 0; }\r
-#endif\r
-\r
-inline int imax (int a, int b)\r
-{ return (a >= b ? a : b); }\r
-\r
-inline double dmax (double a, double b)\r
-{ return (a >= b ? a : b); }\r
-\r
+
+inline bool isEven (int n)
+{ return (n % 2) == 0; }
+
+inline bool isOdd (int n)
+{ return (n % 2) != 0; }
+
+#if 0
+inline bool isEven (long n)
+{ return (n % 2) == 0; }
+
+inline bool isOdd (long n)
+{ return (n % 2) != 0; }
+#endif
+
+inline int imax (int a, int b)
+{ return (a >= b ? a : b); }
+
+inline double dmax (double a, double b)
+{ return (a >= b ? a : b); }
+
 template<class T>
 inline T clamp (T value, T lowerBounds, T upperBounds)
 { return (value >= upperBounds ? upperBounds : (value <= lowerBounds ? lowerBounds : value )); }
@@ -258,7 +258,7 @@ void scale2d (double x[], double y[], int pts, double xfact, double yfact);
 // mathfuncs.cpp
 double normalizeAngle (double theta);
 double integrateSimpson (const double xmin, const double xmax, const double *y, const int np);
-void vectorNumericStatistics (std::vector<double> vec, const int nPoints, double& min, double& max, double& mean, double& mode, double& median, double& stddev);\r
+void vectorNumericStatistics (std::vector<double> vec, const int nPoints, double& min, double& max, double& mean, double& mode, double& median, double& stddev);
 
 
 /*----------------------------------------------------------------------*/
index f6dbf77af635c943fa2f2fd18aa5110fb6fe7393..6a8de8489a23939afe25dc062cb8027dc56a44b4 100644 (file)
@@ -7,7 +7,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezplot.h,v 1.23 2000/12/29 15:45:06 kevin Exp $
+**  $Id: ezplot.h,v 1.24 2001/01/02 16:02:12 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
@@ -32,7 +32,7 @@
 #include <cmath>
 #include <stddef.h>
 #include "ctsupport.h"
-#include "sgp.h"\r
+#include "sgp.h"
 #include "pol.h"
 
 
@@ -52,21 +52,21 @@ public:
 //----------------------------------------------------------------------
 
 // axis definitions 
-enum {\r
+enum {
   LINEAR =     1,              // linear axis 
   LOG,         // logrithmic axis 
-  NOAXIS,      // don't plot axis \r
+  NOAXIS,      // don't plot axis 
 };
 
 // tick definitions 
-enum {\r
+enum {
   ABOVE = 1,
  BELOW,
  RIGHT,
- LEFT,\r
+ LEFT,
 };
 
-// line types \r
+// line types 
 enum {
  NOLINE =      0,
  SOLID,
@@ -74,31 +74,31 @@ enum {
  DASH1,
  DASH2,
  DASH3,
- DASH4,\r
-};\r
+ DASH4,
+};
 
 // symbol definitions 
-enum {\r
+enum {
  SB_CROSS = 1,
  SB_PLUS,
  SB_BOX,
  SB_CIRCLE,
  SB_ERRORBAR,
- MAXSYMBOL,\r
+ MAXSYMBOL,
 };
 
-enum {\r
+enum {
  INSIDE = 1,           // values of o_legendbox 
  OUTSIDE,
- NOLEGEND,\r
-};\r
-\r
+ NOLEGEND,
+};
+
+
+struct KeywordCodeTable {
+  char* keyword;
+  int code;
+};
 
-struct KeywordCodeTable {\r
-  char* keyword;\r
-  int code;\r
-};\r
-\r
 /*-----------------------------------------------------------------------------
 *                              GLOBAL VARIABLES
 *
@@ -137,7 +137,7 @@ private:
   enum {
     S_DATA = 2,
       S_HELP,
-      S_EXIT,\r
+      S_EXIT,
       S_CURVE,
       S_SOLID,
       S_DASH,      
@@ -145,7 +145,7 @@ private:
       S_BLACK,
       S_RED,
       S_GREEN,
-      S_BLUE,\r
+      S_BLUE,
       S_SYMBOL,
       S_PEN,
       S_EVERY,
@@ -207,36 +207,36 @@ private:
       S_TAG,
       S_TEXTSIZE,
   };
-  \r
-  static const struct KeywordCodeTable m_sKeywords[];\r
-  static const int NKEYS;\r
+  
+  static const struct KeywordCodeTable m_sKeywords[];
+  static const int NKEYS;
   
   std::vector<class EZPlotCurve*> m_vecCurves;
-  std::vector<int> m_veciColor;\r
-  std::vector<bool> m_vecbColorSet;\r
-  std::vector<int> m_veciSymbol;\r
-  std::vector<bool> m_vecbSymbolSet;\r
-  std::vector<int> m_veciSymbolFreq;\r
-  std::vector<bool> m_vecbSymbolFreqSet;\r
-  std::vector<int> m_veciLinestyle;\r
-  std::vector<bool> m_vecbLinestyleSet;\r
-  std::vector<std::string> m_vecsLegend;\r
-  std::vector<bool> m_vecbLegendSet;\r
-\r
-  int getColor (unsigned int iCurve) const;\r
-  int getSymbol (unsigned int iCurve) const;\r
-  const std::string* getLegend (unsigned int iCurve) const;\r
-  int getSymbolFreq (unsigned int iCurve) const;\r
-  int getLinestyle (unsigned int iCurve) const;\r
-\r
-  void setColor (unsigned int iCurve, int iColor);\r
-  void setSymbol (unsigned int iCurve, int iSymbol);\r
-  void setSymbolFreq (unsigned int iCurve, int iSymbolFreq);\r
-  void setLinestyle (unsigned int iCurve, int iLinestyle);\r
-  void setLegend (unsigned int iCurve, const std::string& strLegend);\r
-  void setLegend (unsigned int iCurve, const char* const pszLegend);\r
-\r
-  int m_iCurrentCurve;\r
+  std::vector<int> m_veciColor;
+  std::vector<bool> m_vecbColorSet;
+  std::vector<int> m_veciSymbol;
+  std::vector<bool> m_vecbSymbolSet;
+  std::vector<int> m_veciSymbolFreq;
+  std::vector<bool> m_vecbSymbolFreqSet;
+  std::vector<int> m_veciLinestyle;
+  std::vector<bool> m_vecbLinestyleSet;
+  std::vector<std::string> m_vecsLegend;
+  std::vector<bool> m_vecbLegendSet;
+
+  int getColor (unsigned int iCurve) const;
+  int getSymbol (unsigned int iCurve) const;
+  const std::string* getLegend (unsigned int iCurve) const;
+  int getSymbolFreq (unsigned int iCurve) const;
+  int getLinestyle (unsigned int iCurve) const;
+
+  void setColor (unsigned int iCurve, int iColor);
+  void setSymbol (unsigned int iCurve, int iSymbol);
+  void setSymbolFreq (unsigned int iCurve, int iSymbolFreq);
+  void setLinestyle (unsigned int iCurve, int iLinestyle);
+  void setLegend (unsigned int iCurve, const std::string& strLegend);
+  void setLegend (unsigned int iCurve, const char* const pszLegend);
+
+  int m_iCurrentCurve;
 
   // Colors
   int clr_axis;                        // color of all axis lines 
@@ -320,11 +320,11 @@ private:
   int axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp);
   
   SGP* m_pSGP;
-  POL m_pol;\r
+  POL m_pol;
   
   void clearCurves ();
   
-  bool ezcmd (const char* const comm);\r
+  bool ezcmd (const char* const comm);
   bool do_cmd(int lx);
   void bad_option(char *opt);
   void initPlotSettings();
@@ -341,7 +341,7 @@ private:
    EZPlot ();
    ~EZPlot ();
    
-   bool ezset (const std::string& command);\r
+   bool ezset (const std::string& command);
    bool ezset (const char* const command);
    
    void addCurve (const float* x, const double* y, int num);
index a8559390b857ca874b7bc578253fdd3e4c618af4..9528004142059f734ec814e032a04e4be8062dbe 100644 (file)
@@ -1,31 +1,31 @@
-/*****************************************************************************\r
-** FILE IDENTIFICATION\r
-**\r
-**   Name:          fnetorderstream.h\r
-**   Purpose:       Network-order file stream header\r
-**   Programmer:    Kevin Rosenberg\r
-**   Date Started:  Sep 2000\r
-**\r
-**  This is part of the CTSim program\r
-**  Copyright (C) 1983-2000 Kevin Rosenberg\r
-**\r
-**  $Id: fnetorderstream.h,v 1.6 2000/12/16 06:12:47 kevin Exp $\r
-**\r
-**  This program is free software; you can redistribute it and/or modify\r
-**  it under the terms of the GNU General Public License (version 2) as\r
-**  published by the Free Software Foundation.\r
-**\r
-**  This program is distributed in the hope that it will be useful,\r
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-**  GNU General Public License for more details.\r
-**\r
-**  You should have received a copy of the GNU General Public License\r
-**  along with this program; if not, write to the Free Software\r
-**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-******************************************************************************/\r
-\r
-\r
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+**   Name:          fnetorderstream.h
+**   Purpose:       Network-order file stream header
+**   Programmer:    Kevin Rosenberg
+**   Date Started:  Sep 2000
+**
+**  This is part of the CTSim program
+**  Copyright (C) 1983-2000 Kevin Rosenberg
+**
+**  $Id: fnetorderstream.h,v 1.7 2001/01/02 16:02:12 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
+**  published by the Free Software Foundation.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+******************************************************************************/
+
+
 #ifndef NETORDER_H
 #define NETORDER_H
 
index 95aaeb01ed85d02e30ee2a121b9cfe4dd4fd5640..5145cae37faebdd2902aa0971a38ca6472dc0351 100644 (file)
@@ -1,45 +1,45 @@
-/*****************************************************************************\r
-** FILE IDENTIFICATION\r
-**\r
-**   Name:          fourier.h\r
-**   Purpose:       Header for Fourier transform functions\r
-**   Programmer:    Kevin Rosenberg\r
-**   Date Started:  Dec 2000\r
-**\r
-**  This is part of the CTSim program\r
-**  Copyright (C) 1983-2001 Kevin Rosenberg\r
-**\r
-**  $Id: fourier.h,v 1.1 2001/01/02 06:33:04 kevin Exp $\r
-**\r
-**  This program is free software; you can redistribute it and/or modify\r
-**  it under the terms of the GNU General Public License (version 2) as\r
-**  published by the Free Software Foundation.\r
-**\r
-**  This program is distributed in the hope that it will be useful,\r
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-**  GNU General Public License for more details.\r
-**\r
-**  You should have received a copy of the GNU General Public License\r
-**  along with this program; if not, write to the Free Software\r
-**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-******************************************************************************/\r
-\r
-#include <complex>\r
-\r
-class ImageFile;\r
-\r
-class Fourier {\r
-public:\r
-    static void shuffleFourierToNaturalOrder (ImageFile& im);\r
-    static void shuffleNaturalToFourierOrder (ImageFile& im);\r
-\r
-    static void shuffleNaturalToFourierOrder (float* pdVector, const int n);\r
-    static void shuffleNaturalToFourierOrder (double* pdVector, const int n);\r
-    static void shuffleNaturalToFourierOrder (std::complex<double>* pdVector, const int n);\r
-    static void shuffleFourierToNaturalOrder (float* 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
-\r
-}; // namespace Fourier\r
-\r
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+**   Name:          fourier.h
+**   Purpose:       Header for Fourier transform functions
+**   Programmer:    Kevin Rosenberg
+**   Date Started:  Dec 2000
+**
+**  This is part of the CTSim program
+**  Copyright (C) 1983-2001 Kevin Rosenberg
+**
+**  $Id: fourier.h,v 1.2 2001/01/02 16:02:12 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
+**  published by the Free Software Foundation.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+******************************************************************************/
+
+#include <complex>
+
+class ImageFile;
+
+class Fourier {
+public:
+    static void shuffleFourierToNaturalOrder (ImageFile& im);
+    static void shuffleNaturalToFourierOrder (ImageFile& im);
+
+    static void shuffleNaturalToFourierOrder (float* pdVector, const int n);
+    static void shuffleNaturalToFourierOrder (double* pdVector, const int n);
+    static void shuffleNaturalToFourierOrder (std::complex<double>* pdVector, const int n);
+    static void shuffleFourierToNaturalOrder (float* pdVector, const int n);
+    static void shuffleFourierToNaturalOrder (double* pdVector, const int n);
+    static void shuffleFourierToNaturalOrder (std::complex<double>* pdVector, const int n);
+
+}; // namespace Fourier
+
index 0f97edf45371ec30a79da28b27654cb2cc48263c..ea5dc43729a40fa254aea1a974ac783807866915 100644 (file)
@@ -1,87 +1,87 @@
-/* FILE IDENTIFICATION\r
-**\r
-**     File Name:      hashtable.h\r
-**     Author:         Kevin Rosenberg\r
-**     Purpose:        Header file for hash table library\r
-**     Date Started:   Dec. 2000\r
-**\r
-**  This is part of the CTSim program\r
-**  Copyright (C) 1983-2000 Kevin Rosenberg\r
-**\r
-**  $Id: hashtable.h,v 1.1 2000/12/27 20:09:19 kevin Exp $\r
-**\r
-**\r
-**  This program is free software; you can redistribute it and/or modify\r
-**  it under the terms of the GNU General Public License (version 2) as\r
-**  published by the Free Software Foundation.\r
-**\r
-**  This program is distributed in the hope that it will be useful,\r
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-**  GNU General Public License for more details.\r
-**\r
-**  You should have received a copy of the GNU General Public License\r
-**  along with this program; if not, write to the Free Software\r
-**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-******************************************************************************/\r
-\r
-#ifndef HASHTABLE_H\r
-#define HASHTABLE_H\r
-\r
-\r
-class KeywordCodeEntry\r
-{\r
-private:\r
-  std::string m_strKeyword;\r
-  int m_iCode;\r
-  class KeywordCodeEntry *m_pNext;\r
-  \r
-  public:\r
-    \r
-    KeywordCodeEntry (const char* const pszKeyword, int iCode);\r
-    \r
-    const char* const getKeyword() const\r
-    { return m_strKeyword.c_str(); }\r
-\r
-    bool matchesKeyword (const char* const pszMatch) const;\r
-\r
-    int getCode () const\r
-    { return m_iCode; }\r
-    \r
-    void setCode (int iCode) \r
-    { m_iCode = iCode; }\r
-    \r
-    void setNext (KeywordCodeEntry* pNext)\r
-    { m_pNext = pNext; }\r
-    \r
-    KeywordCodeEntry* getNext ()\r
-    { return m_pNext; }\r
-};\r
-\r
-\r
-class KeywordCodeHashTable {\r
-public:\r
-  enum {\r
-    HASHSIZE = 100,\r
-  };\r
-  \r
-  KeywordCodeHashTable()\r
-  { initTable(); }\r
-  \r
-  ~KeywordCodeHashTable()\r
-  { freeTable(); }\r
-  \r
-  void installKeywordCode (const char* const pszKeyword, int iCode);\r
-  KeywordCodeEntry* lookup (const char* const pszKeyword);\r
-  \r
-private:\r
-  KeywordCodeEntry* m_hashTable[HASHSIZE];\r
-  \r
-  int hash (const char* s);\r
-  void initTable ();\r
-  void freeTable ();\r
-};\r
-\r
-#endif\r
-\r
-\r
+/* FILE IDENTIFICATION
+**
+**     File Name:      hashtable.h
+**     Author:         Kevin Rosenberg
+**     Purpose:        Header file for hash table library
+**     Date Started:   Dec. 2000
+**
+**  This is part of the CTSim program
+**  Copyright (C) 1983-2000 Kevin Rosenberg
+**
+**  $Id: hashtable.h,v 1.2 2001/01/02 16:02:12 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
+**  published by the Free Software Foundation.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+******************************************************************************/
+
+#ifndef HASHTABLE_H
+#define HASHTABLE_H
+
+
+class KeywordCodeEntry
+{
+private:
+  std::string m_strKeyword;
+  int m_iCode;
+  class KeywordCodeEntry *m_pNext;
+  
+  public:
+    
+    KeywordCodeEntry (const char* const pszKeyword, int iCode);
+    
+    const char* const getKeyword() const
+    { return m_strKeyword.c_str(); }
+
+    bool matchesKeyword (const char* const pszMatch) const;
+
+    int getCode () const
+    { return m_iCode; }
+    
+    void setCode (int iCode) 
+    { m_iCode = iCode; }
+    
+    void setNext (KeywordCodeEntry* pNext)
+    { m_pNext = pNext; }
+    
+    KeywordCodeEntry* getNext ()
+    { return m_pNext; }
+};
+
+
+class KeywordCodeHashTable {
+public:
+  enum {
+    HASHSIZE = 100,
+  };
+  
+  KeywordCodeHashTable()
+  { initTable(); }
+  
+  ~KeywordCodeHashTable()
+  { freeTable(); }
+  
+  void installKeywordCode (const char* const pszKeyword, int iCode);
+  KeywordCodeEntry* lookup (const char* const pszKeyword);
+  
+private:
+  KeywordCodeEntry* m_hashTable[HASHSIZE];
+  
+  int hash (const char* s);
+  void initTable ();
+  void freeTable ();
+};
+
+#endif
+
+
index 3587f1cde01e5cc90b905ea5bafd9874200ca4d5..eaa69afa89e97556e7bea844ba5e0f669c784c35 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: imagefile.h,v 1.27 2001/01/02 05:34:57 kevin Exp $
+**  $Id: imagefile.h,v 1.28 2001/01/02 16:02:12 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
@@ -28,9 +28,9 @@
 #ifndef IMAGEFILE_H
 #define IMAGEFILE_H
 
-#ifndef MSVC\r
-#include <unistd.h>\r
-#endif\r
+#ifndef MSVC
+#include <unistd.h>
+#endif
 #include <string>
 #include <sys/types.h>
 #include <fstream>
@@ -47,20 +47,20 @@ class F32Image : public Array2dFile
 {
 public:
   F32Image (int nx, int ny, int dataType = Array2dFile::DATA_TYPE_REAL);     
-  F32Image (void);\r
-
-  kfloat32** getArray (void)\r
-      { return (kfloat32**) (m_arrayData); }\r
-\r
-  kfloat32** const getArray (void) const\r
-       { return (kfloat32** const) (m_arrayData); }\r
-\r
-  kfloat32** getImaginaryArray (void)\r
-      { return (kfloat32**) (m_imaginaryArrayData); }\r
-\r
-  kfloat32** const getImaginaryArray (void) const\r
-       { return (kfloat32** const) (m_imaginaryArrayData); }\r
-\r
+  F32Image (void);
+
+  kfloat32** getArray (void)
+      { return (kfloat32**) (m_arrayData); }
+
+  kfloat32** const getArray (void) const
+       { return (kfloat32** const) (m_arrayData); }
+
+  kfloat32** getImaginaryArray (void)
+      { return (kfloat32**) (m_imaginaryArrayData); }
+
+  kfloat32** const getImaginaryArray (void) const
+       { return (kfloat32** const) (m_imaginaryArrayData); }
+
 #ifdef HAVE_MPI
   MPI::Datatype getMPIDataType (void) const
       { return MPI::FLOAT; }
@@ -79,18 +79,18 @@ class F64Image : public Array2dFile
    F64Image (int nx, int ny, int dataType = Array2dFile::DATA_TYPE_REAL);
   F64Image (void);
 
-  kfloat64** getArray (void)\r
-      { return (kfloat64**) (m_arrayData); }\r
-\r
-  kfloat64** const getArray (void) const\r
-      { return (kfloat64** const) (m_arrayData); }\r
-\r
-  kfloat64** getImaginaryArray (void)\r
-      { return (kfloat64**) (m_imaginaryArrayData); }\r
-\r
-  kfloat64** const getImaginaryArray (void) const\r
-      { return (kfloat64** const) (m_imaginaryArrayData); }\r
-\r
+  kfloat64** getArray (void)
+      { return (kfloat64**) (m_arrayData); }
+
+  kfloat64** const getArray (void) const
+      { return (kfloat64** const) (m_arrayData); }
+
+  kfloat64** getImaginaryArray (void)
+      { return (kfloat64**) (m_imaginaryArrayData); }
+
+  kfloat64** const getImaginaryArray (void) const
+      { return (kfloat64** const) (m_imaginaryArrayData); }
+
 #ifdef HAVE_MPI
   MPI::Datatype getMPIDataType (void) const
       { return MPI::DOUBLE; }
@@ -106,7 +106,7 @@ typedef F64Image   ImageFileBase;
 typedef kfloat64   ImageFileValue;
 typedef kfloat64*  ImageFileColumn;
 typedef kfloat64** ImageFileArray;
-typedef kfloat64** const ImageFileArrayConst;\r
+typedef kfloat64** const ImageFileArrayConst;
 typedef const kfloat64* ImageFileColumnConst;
 #else
 typedef F32Image   ImageFileBase;
@@ -114,34 +114,34 @@ typedef kfloat32   ImageFileValue;
 typedef kfloat32*  ImageFileColumn;
 typedef kfloat32** ImageFileArray;
 typedef kfloat32** const ImageFileArrayConst;
-typedef const kfloat32* ImageFileColumnConst;\r
+typedef const kfloat32* ImageFileColumnConst;
 #endif
 
 
 class ImageFile : public ImageFileBase
-{\r
-private:\r
-\r
-  static const char* s_aszFormatName[];\r
-  static const char* s_aszFormatTitle[];\r
-  static const int s_iFormatCount;\r
-
-public:\r
-\r
-  static const int FORMAT_INVALID;\r
-  static const int FORMAT_PGM;\r
-  static const int FORMAT_PGMASCII;\r
-#if HAVE_PNG\r
-  static const int FORMAT_PNG;\r
-  static const int FORMAT_PNG16;\r
-#endif\r
-\r
-  static const int getFormatCount() {return s_iFormatCount;}\r
-  static const char** getFormatNameArray() {return s_aszFormatName;}\r
-  static const char** getFormatTitleArray() {return s_aszFormatTitle;}\r
-  static int convertFormatNameToID (const char* const formatName);\r
-  static const char* convertFormatIDToName (const int formatID);\r
-  static const char* convertFormatIDToTitle (const int formatID);\r
+{
+private:
+
+  static const char* s_aszFormatName[];
+  static const char* s_aszFormatTitle[];
+  static const int s_iFormatCount;
+
+public:
+
+  static const int FORMAT_INVALID;
+  static const int FORMAT_PGM;
+  static const int FORMAT_PGMASCII;
+#if HAVE_PNG
+  static const int FORMAT_PNG;
+  static const int FORMAT_PNG16;
+#endif
+
+  static const int getFormatCount() {return s_iFormatCount;}
+  static const char** getFormatNameArray() {return s_aszFormatName;}
+  static const char** getFormatTitleArray() {return s_aszFormatTitle;}
+  static int convertFormatNameToID (const char* const formatName);
+  static const char* convertFormatIDToName (const int formatID);
+  static const char* convertFormatIDToTitle (const int formatID);
 
   ImageFile (int nx, int ny)
       : ImageFileBase (nx, ny)
@@ -150,44 +150,44 @@ public:
   ImageFile (void)
       : ImageFileBase ()
   {}
-\r
-  bool convertRealToComplex ();\r
-  bool convertComplexToReal ();\r
+
+  bool convertRealToComplex ();
+  bool convertComplexToReal ();
 
   void filterResponse (const char* const domainName, double bw, const char* const filterName, double filt_param, double dInputScale = 1., double dOutputScale = 1.);
 
-  void statistics (double& min, double& max, double& mean, double& mode, double& median, double& stddev) const;\r
-  void statistics (ImageFileArrayConst v, double& min, double& max, double& mean, double& mode, double& median, double& stddev) const;\r
+  void statistics (double& min, double& max, double& mean, double& mode, double& median, double& stddev) const;
+  void statistics (ImageFileArrayConst v, 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;
-  bool addImages (const ImageFile& rRHS, ImageFile& result) const;\r
-  bool multiplyImages (const ImageFile& rRHS, ImageFile& result) const;\r
-  bool divideImages (const ImageFile& rRHS, ImageFile& result) const;\r
-\r
-  bool scaleImage (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 fourier (ImageFile& result) const;\r
-  bool inverseFourier (ImageFile& result) const;\r
-#ifdef HAVE_FFTW\r
-  bool fft (ImageFile& result) const;\r
-  bool ifft (ImageFile& result) const;\r
-#endif\r
-  bool magnitude (ImageFile& result) const;\r
-  bool phase (ImageFile& result) const;\r
-\r
+  bool addImages (const ImageFile& rRHS, ImageFile& result) const;
+  bool multiplyImages (const ImageFile& rRHS, ImageFile& result) const;
+  bool divideImages (const ImageFile& rRHS, ImageFile& result) const;
+
+  bool scaleImage (ImageFile& result) const;
+
+  bool invertPixelValues (ImageFile& result) const;
+  bool sqrt (ImageFile& result) const;
+  bool square (ImageFile& result) const;
+  bool log (ImageFile& result) const;
+  bool exp (ImageFile& result) const;
+  bool fourier (ImageFile& result) const;
+  bool inverseFourier (ImageFile& result) const;
+#ifdef HAVE_FFTW
+  bool fft (ImageFile& result) const;
+  bool ifft (ImageFile& result) const;
+#endif
+  bool magnitude (ImageFile& result) const;
+  bool phase (ImageFile& result) const;
+
   int display (void) const;
   int displayScaling (const int scaleFactor, ImageFileValue pmin, ImageFileValue pmax) const;
-\r
-  bool exportImage (const char* const pszFormat, const char* const pszFilename, int nxcell, int nycell, double densmin, double densmax);\r
+
+  bool exportImage (const char* const pszFormat, const char* const pszFilename, int nxcell, int nycell, double densmin, double densmax);
 
 #if HAVE_PNG
   bool writeImagePNG (const char* const outfile, int bitdepth, int nxcell, int nycell, double densmin, double densmax);
index 188d8498715f7ca642b88640ea554aa95e1e2892..494e3624335380780d57da8ccc4ac3731baf88e5 100644 (file)
@@ -10,7 +10,7 @@
   #define strcasecmp _stricmp
   #define strncasecmp _strnicmp
   #define snprintf _snprintf
-  #define vsnprintf _vsnprintf\r
+  #define vsnprintf _vsnprintf
   #pragma warning(disable:4786)
 #endif
 #endif
index f8187c2f3d0d303cb40ac24625ad7ef875932682..286f3ed0e94e68603d37051a989cac8f6803a415 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phantom.h,v 1.19 2001/01/02 07:47:36 kevin Exp $
+**  $Id: phantom.h,v 1.20 2001/01/02 16:02:12 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
@@ -64,10 +64,10 @@ class PhantomElement
 
     const int nOutlinePoints() const {return m_nPoints;}
     double* rectLimits() {return m_rectLimits;}
-    double* xOutline() {return m_xOutline;}\r
-    double* yOutline() {return m_yOutline;}\r
-    double* const xOutline() const {return m_xOutline;}\r
-    double* const yOutline() const {return m_yOutline;}\r
+    double* xOutline() {return m_xOutline;}
+    double* yOutline() {return m_yOutline;}
+    double* const xOutline() const {return m_xOutline;}
+    double* const yOutline() const {return m_yOutline;}
     const double atten() const {return m_atten;}
     const double diameter() const {return m_diameter;}
     const double xmin() const {return m_xmin;}
@@ -78,8 +78,8 @@ class PhantomElement
     const double cx() const {return m_cx;}
     const double cy() const {return m_cy;}
     const double u() const {return m_u;}
-    const double v() const {return m_v;}\r
-\r
+    const double v() const {return m_v;}
+
     void printDefinition (std::ostream& os) const;
     void printDefinition (std::ostringstream& os) const;
 
@@ -103,7 +103,7 @@ class PhantomElement
     static const double SCALE_PELEM_EXTENT;  // increase pelem limits by 0.5% 
 
     static PhmElemType convertNameToType (const char* const typeName);
-    static const char* const convertTypeToName (PhmElemType iType);\r
+    static const char* const convertTypeToName (PhmElemType iType);
 
     void makeTransformMatrices ();
 
@@ -159,8 +159,8 @@ class Phantom
     bool createFromPhantom (const int phmid);
 
     bool createFromFile (const char* const fname);
-\r
-    bool fileWrite (const char* const fname);\r
+
+    bool fileWrite (const char* const fname);
 
     void addPElem (const PhantomElement& pelem);
 
@@ -169,9 +169,9 @@ class Phantom
     void convertToImagefile (ImageFile& im, const int in_nsample, const int trace, const int colStart, const int colCount, bool bStoreAtColumnPos) const;
 
     void convertToImagefile (ImageFile& im, const int in_nsample, const int trace) const;
-\r
-    void printDefinitions (std::ostream& os) const;\r
-    void printDefinitions (std::ostringstream& os) const;\r
+
+    void printDefinitions (std::ostream& os) const;
+    void printDefinitions (std::ostringstream& os) const;
 
     bool fail() const             {return m_fail;}
     const std::string& failMessage() const {return m_failMessage;}
index b88793f43ff99d6f8713cf730b7e296ef93efc1e..409746965ff014e898bf24e2141b7232451264f3 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: plotfile.h,v 1.5 2001/01/02 07:47:36 kevin Exp $
+**  $Id: plotfile.h,v 1.6 2001/01/02 16:02:12 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 <iostream>
 #include <vector>
 #include "ctsupport.h"
-#include "plotfile.h"\r
+#include "plotfile.h"
 
 
 // Plotfile structure:
 // 1. Lines that begin with # are comments
 // 2. ASCII file format
 // 3. Header lines begin with <tags> and end with </tags>
-// 4. Valid headers\r
+// 4. Valid headers
 //      <plotfile ncolumns nrecords>    (signifies beginning of plotfile)
-//      <description> (beginning of description lines)\r
-//      <ezset>       (signifies beginning of ezset commands)\r
+//      <description> (beginning of description lines)
+//      <ezset>       (signifies beginning of ezset commands)
 //      <columns>     Beginning of data columns
 // 5. Data is ASCII file format, one record per line
 //    Number of columns is variable and is set by ncolumns header
-\r
+
 
 
 class PlotFile 
@@ -63,7 +63,7 @@ class PlotFile
  private:
   std::string m_strFilename;
   std::string m_strDate;
-  std::vector<std::string> m_vecStrDescriptions;\r
+  std::vector<std::string> m_vecStrDescriptions;
   std::vector<std::string> m_vecStrEzsetCommands;
   std::vector<double> m_vecCurves;
   int m_iNumColumns;
@@ -86,18 +86,18 @@ public:
 
   void setCurveSize (int iNCurves, int iNRecords);
 
-  void addDescription (const char* const pszDesc)\r
-    { m_vecStrDescriptions.push_back (pszDesc); }\r
-\r
-  void addEzsetCommand (const char* const pszCmd)\r
-    { m_vecStrEzsetCommands.push_back (pszCmd); }\r
+  void addDescription (const char* const pszDesc)
+    { m_vecStrDescriptions.push_back (pszDesc); }
+
+  void addEzsetCommand (const char* const pszCmd)
+    { m_vecStrEzsetCommands.push_back (pszCmd); }
   
   bool addColumn (int iCol, const double* const pdColumn);
 
-  bool addColumn (int iCol, const float* const pdColumn);\r
-\r
-  void getColumn (int iCol, double *pdColumnData) const;\r
-\r
+  bool addColumn (int iCol, const float* const pdColumn);
+
+  void getColumn (int iCol, double *pdColumnData) const;
+
   const std::string& getDate () const
     { return m_strDate; }
 
@@ -106,10 +106,10 @@ public:
 
   int getNumRecords () const
     { return m_iNumRecords; }
-\r
-  bool getMinMax (int startingCol, double& min, double& max) const;\r
-\r
-  bool statistics (int startingCol, double& min, double& max, double& mean, double& mode, double& median, double &stddev) const;\r
+
+  bool getMinMax (int startingCol, double& min, double& max) const;
+
+  bool statistics (int startingCol, double& min, double& max, double& mean, double& mode, double& median, double &stddev) const;
 
   unsigned int getNumDescriptions (void) const
       { return m_vecStrDescriptions.size(); }
@@ -117,12 +117,12 @@ public:
   const std::string& getDescription (int iDescIndex) const
     { return m_vecStrDescriptions[iDescIndex]; }
 
-  unsigned int getNumEzsetCommands (void) const\r
-      { return m_vecStrEzsetCommands.size(); }\r
-\r
-  const std::string& getEzsetCommand (int iIndex) const\r
-    { return m_vecStrEzsetCommands[iIndex]; }\r
-\r
+  unsigned int getNumEzsetCommands (void) const
+      { return m_vecStrEzsetCommands.size(); }
+
+  const std::string& getEzsetCommand (int iIndex) const
+    { return m_vecStrEzsetCommands[iIndex]; }
+
   bool fileRead (const char* const filename);
 
   bool fileWrite (const char* const filename);
index 1d149896801205c8621c6fe971ecaaf0bb70644f..f8f44e5f263636375b472bb9ddf6990bc49a6ef8 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: pol.h,v 1.10 2000/12/29 20:11:42 kevin Exp $
+**  $Id: pol.h,v 1.11 2001/01/02 16:02:12 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
 ******************************************************************************/
 #ifndef __H_POL
 #define __H_POL
-\r
-#include "hashtable.h"\r
-#include <stack>\r
+
+#include "hashtable.h"
+#include <stack>
 
 class POL {
   
   public:
     
-    // codes for pol_usefile \r
-    enum {\r
-      P_USE_STR = 1,           // use string as input source \r
-      P_USE_FILE,                // use file as input source \r
-    };\r
-\r
-  \r
+    // codes for pol_usefile 
+    enum {
+      P_USE_STR = 1,           // use string as input source 
+      P_USE_FILE,                // use file as input source 
+    };
+
+  
     POL();
     ~POL();
     
@@ -57,157 +57,157 @@ class POL {
     int get_inputline (FILE *fp);
     void set_inputline (const char* const line);
     
-\r
-  enum {\r
-    MAXTOK = 200,              // maximum length of a token \r
-      MAXLINE = 1024,       // maximum line length\r
-      MAXIDENT = 20,\r
-      MAXSKIPWORD = 20,\r
-      MAXSKIPCHAR = 20,\r
-      MIN_INT = -2000000000,\r
-      MAX_INT =  2000000000,\r
-  };\r
-  \r
-  // token types \r
-  enum {\r
-    TT_STRING = 1,  // string token \r
-      TT_INT,         // integer token \r
-      TT_REAL,                 // floating point token \r
-      TT_ALPHA,                // alphabetic token \r
-      TT_ALPNUM,               // alphanumeric token \r
-      TT_NUMALPHA,\r
-      TT_SPECLCHAR,\r
-      TT_EOF,         // end of file reached \r
-      TT_ERROR,       // error in token, caused by call to wrong type of token reader \r
-      TT_BLANK,        // white space token.  pol_tok() skips these \r
-      TT_USERTOK,     // user defined token \r
-  };\r
-\r
-  \r
-private:\r
-  \r
-  // codes for pol_int and pol_float \r
-  // if in reject catagory, get new number from terminal \r
-  enum {\r
-    P_FLTINT = 1,       // get a real or integer number \r
-      P_BFLTINT,     // get a real or integer number, clip against bounds \r
-      P_CBFLTINT,       // get real or int, reject if outside bounds \r
-      P_FLT,              // get a real number \r
-      P_BFLT,        // get a real, clip against bounds \r
-      P_CBFLT,       // get a floating, reject if outside bounds \r
-      P_INT,         // get a integer number \r
-      P_BINT,        // get a integer, clip against bounds \r
-      P_CBINT,       // get a integer, reject if outside bounds \r
-  };\r
-  \r
-#define LETTER   'a'\r
-#define DIGIT    '0'\r
-  \r
-  \r
-//  typedef std::map<std::string,int> KeywordCodeList;\r
-  \r
-  struct token_st {\r
-    int ready;                         // TRUE if token is ready \r
-  //  std::string tokstr;      // token string \r
-    char tokstr[MAXTOK+1];\r
-    int type;                            // type of token 'TT_' \r
-    int code;                            // holds code for user defined tokens \r
-    double fnum;                       // real value of token \r
-    int inum;                      // integer value of token \r
-  };\r
-  typedef struct token_st TOKEN;\r
-  struct token_st token;                               // current token \r
-   \r
-  // Tables words stored with install() & found with lookup() \r
-  KeywordCodeHashTable skiptable;              // words to ignore and skip \r
-  KeywordCodeHashTable cmdtable;               // pol parameter commands \r
-  KeywordCodeHashTable usertable;              // user defined symbols \r
-  \r
-  struct metachar {\r
-    char eoc;          /* end of command character */\r
-    char str;          /* string delimiter */\r
-    char com;          /* comment character */\r
-    char cmd;          /* pol parameter command character */\r
-    char prg;          /* program load character */\r
-    char con;          /* continuation across newline character */\r
-    char out;          /* character that delimits output to terminal */\r
-    char ter;          /* character indicates insertion of input from terminal */\r
-    char inb;          /* input from graphics device */\r
-  } meta;\r
-  \r
-  \r
-  char m_szSkipChars [MAXSKIPCHAR]; // characters to skip\r
-  bool m_bTrace;\r
-  bool m_bNewlineIsEOC;\r
-  \r
-  struct KeywordCodeList {\r
-    char *keyword;\r
-    int  code;\r
-  };\r
-  \r
-  static const struct KeywordCodeList cmdlist[];\r
-  static const unsigned int NUMCMD;\r
-  \r
-  // Internal codes for pol commands \r
-  enum {\r
-    PC_EOC = 1,\r
-      PC_STR,\r
-      PC_COM,\r
-      PC_CMD,\r
-      PC_PRG,\r
-      PC_CON,  \r
-      PC_OUT,\r
-      PC_TER,\r
-      PC_INB,     \r
-      PC_NL_EOC,\r
-      PC_NL_NEOC,\r
-      PC_TRON,\r
-      PC_TROFF,\r
-      PC_FILE,\r
-      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
-  \r
-  int currentf;                /* pointer to current fp */\r
-  FILE *filep[MAXFILE];                /* == NULL for string input */\r
-  char *fname[MAXFILE];                /* pointer to filename */\r
-  \r
-  char inputline[MAXLINE];             /* current input line */\r
-  int lineptr;                 /* current position in inputline */\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
-  \r
-  \r
-  int getpol_tok (struct token_st *token);\r
-  int getcmd ();\r
-  int gettok (TOKEN *tok);\r
-  void getblank (char *s, int toksiz);\r
-  int getalpha (char *s, int toksiz);\r
-  void getquote (char *qs, int toksiz);\r
-  void getescape (char *s, int delim, int toksiz);\r
-  int getnumber (char str[], int strsize, double *fnum, int *inum);\r
-  void eatline ();\r
-  int type (int c);\r
-  int getch (FILE *fp);\r
-  \r
+
+  enum {
+    MAXTOK = 200,              // maximum length of a token 
+      MAXLINE = 1024,       // maximum line length
+      MAXIDENT = 20,
+      MAXSKIPWORD = 20,
+      MAXSKIPCHAR = 20,
+      MIN_INT = -2000000000,
+      MAX_INT =  2000000000,
+  };
+  
+  // token types 
+  enum {
+    TT_STRING = 1,  // string token 
+      TT_INT,         // integer token 
+      TT_REAL,                 // floating point token 
+      TT_ALPHA,                // alphabetic token 
+      TT_ALPNUM,               // alphanumeric token 
+      TT_NUMALPHA,
+      TT_SPECLCHAR,
+      TT_EOF,         // end of file reached 
+      TT_ERROR,       // error in token, caused by call to wrong type of token reader 
+      TT_BLANK,        // white space token.  pol_tok() skips these 
+      TT_USERTOK,     // user defined token 
+  };
+
+  
+private:
+  
+  // codes for pol_int and pol_float 
+  // if in reject catagory, get new number from terminal 
+  enum {
+    P_FLTINT = 1,       // get a real or integer number 
+      P_BFLTINT,     // get a real or integer number, clip against bounds 
+      P_CBFLTINT,       // get real or int, reject if outside bounds 
+      P_FLT,              // get a real number 
+      P_BFLT,        // get a real, clip against bounds 
+      P_CBFLT,       // get a floating, reject if outside bounds 
+      P_INT,         // get a integer number 
+      P_BINT,        // get a integer, clip against bounds 
+      P_CBINT,       // get a integer, reject if outside bounds 
+  };
+  
+#define LETTER   'a'
+#define DIGIT    '0'
+  
+  
+//  typedef std::map<std::string,int> KeywordCodeList;
+  
+  struct token_st {
+    int ready;                         // TRUE if token is ready 
+  //  std::string tokstr;      // token string 
+    char tokstr[MAXTOK+1];
+    int type;                            // type of token 'TT_' 
+    int code;                            // holds code for user defined tokens 
+    double fnum;                       // real value of token 
+    int inum;                      // integer value of token 
+  };
+  typedef struct token_st TOKEN;
+  struct token_st token;                               // current token 
+   
+  // Tables words stored with install() & found with lookup() 
+  KeywordCodeHashTable skiptable;              // words to ignore and skip 
+  KeywordCodeHashTable cmdtable;               // pol parameter commands 
+  KeywordCodeHashTable usertable;              // user defined symbols 
+  
+  struct metachar {
+    char eoc;          /* end of command character */
+    char str;          /* string delimiter */
+    char com;          /* comment character */
+    char cmd;          /* pol parameter command character */
+    char prg;          /* program load character */
+    char con;          /* continuation across newline character */
+    char out;          /* character that delimits output to terminal */
+    char ter;          /* character indicates insertion of input from terminal */
+    char inb;          /* input from graphics device */
+  } meta;
+  
+  
+  char m_szSkipChars [MAXSKIPCHAR]; // characters to skip
+  bool m_bTrace;
+  bool m_bNewlineIsEOC;
+  
+  struct KeywordCodeList {
+    char *keyword;
+    int  code;
+  };
+  
+  static const struct KeywordCodeList cmdlist[];
+  static const unsigned int NUMCMD;
+  
+  // Internal codes for pol commands 
+  enum {
+    PC_EOC = 1,
+      PC_STR,
+      PC_COM,
+      PC_CMD,
+      PC_PRG,
+      PC_CON,  
+      PC_OUT,
+      PC_TER,
+      PC_INB,     
+      PC_NL_EOC,
+      PC_NL_NEOC,
+      PC_TRON,
+      PC_TROFF,
+      PC_FILE,
+      PC_DUMP,
+  };
+  
+  enum {
+    INPUT_STREAM = 1,
+    INPUT_FILE,
+    INPUT_STRING,
+  };
+
+  int m_iInputType;
+  std::istream* m_pInputStream;
+  FILE* m_pInputFile;
+  char* m_pszInputString;
+
+  enum {
+    MAXFILE = 8,
+  };
+  
+  int currentf;                /* pointer to current fp */
+  FILE *filep[MAXFILE];                /* == NULL for string input */
+  char *fname[MAXFILE];                /* pointer to filename */
+  
+  char inputline[MAXLINE];             /* current input line */
+  int lineptr;                 /* current position in inputline */
+  
+  std::stack<int> m_stackPushBackInput;
+
+  bool skipSingleToken (char term[]);
+  int tok (struct token_st *token);
+  void dumptok (struct token_st *token);
+  
+  
+  int getpol_tok (struct token_st *token);
+  int getcmd ();
+  int gettok (TOKEN *tok);
+  void getblank (char *s, int toksiz);
+  int getalpha (char *s, int toksiz);
+  void getquote (char *qs, int toksiz);
+  void getescape (char *s, int delim, int toksiz);
+  int getnumber (char str[], int strsize, double *fnum, int *inum);
+  void eatline ();
+  int type (int c);
+  int getch (FILE *fp);
+  
 };
 
 #endif
index 2be3b7c20a65d535e53141bb3c607ac141029257..a3b74402c9c6a62fcd3ffad605d2eacb991c6f78 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: procsignal.h,v 1.11 2001/01/02 05:34:57 kevin Exp $
+**  $Id: procsignal.h,v 1.12 2001/01/02 16:02:12 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
@@ -41,9 +41,9 @@
 
 class SignalFilter;
 class SGP;
-\r
-typedef std::complex<double> CTSimComplex;\r
-\r
+
+typedef std::complex<double> CTSimComplex;
+
 
 class ProcessSignal {
  public:
@@ -60,11 +60,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
+
+    enum {
+      FORWARD = -1,
+      BACKWARD = 1,
+    };
 
     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);
 
@@ -105,7 +105,7 @@ class ProcessSignal {
     static void finiteFourierTransform (const double input[], std::complex<double> output[], const int n, const int direction);
     static void finiteFourierTransform (const std::complex<double> input[], std::complex<double> output[], const int n, const int direction);
     static void finiteFourierTransform (const std::complex<double> input[], double output[], const int n, const int direction);
-\r
+
 
  private:
         std::string m_nameFilterMethod;
index 2a1472b20ee9ba80c4c144b80d09e3d8d5e86266..2d83b2ed6b2eaac7ca02497a530461e6023551e8 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: sgp.h,v 1.23 2000/12/25 21:54:26 kevin Exp $
+**  $Id: sgp.h,v 1.24 2001/01/02 16:02:13 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
@@ -127,7 +127,7 @@ private:
   double m_dTextAngle;
   bool m_bRecalcTransform;
   double m_dPointsPerPixel;  // points (72pt/in) per screen pixel;
-  int m_iLinestyle;\r
+  int m_iLinestyle;
 
   // Master coordinates are coordinates before CTM transformation
   // World coordinates are coordinates defined by setWindow()
@@ -175,7 +175,7 @@ public:
   static const unsigned char MARKER_BITMAP[MARK_COUNT][5];
 
   SGP (const SGPDriver& driver);
-  ~SGP();\r
+  ~SGP();
 
   void drawCircle (const double r);
   void drawArc (const double r, double start, double stop);
index 222b3cd5a77c08d1986847f7b0be87cf9002a160..e70620f7188021221bea3d1904f201a90eae8324 100644 (file)
@@ -6,7 +6,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezset.cpp,v 1.15 2000/12/29 15:45:06 kevin Exp $
+**  $Id: ezset.cpp,v 1.16 2001/01/02 16:02:13 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 "ezplot.h"
 #include "pol.h"
 
-\r
-bool\r
-EZPlot::ezset (const std::string& command)\r
-{\r
-  return ezset (command.c_str());\r
-}\r
+
+bool
+EZPlot::ezset (const std::string& command)
+{
+  return ezset (command.c_str());
+}
 
 bool 
 EZPlot::ezset (const char* const command)
 {
-\r
+
     return ezcmd (command);
 }
 
@@ -91,8 +91,8 @@ EZPlot::do_cmd (int lx)
     c_title = strIn;
     break;
   case S_LEGEND:
-    m_pol.readText (strIn, sizeof(strIn));\r
-    if (m_iCurrentCurve >= 0)\r
+    m_pol.readText (strIn, sizeof(strIn));
+    if (m_iCurrentCurve >= 0)
       setLegend (m_iCurrentCurve, strIn);
     break;
   case S_XLABEL:
@@ -171,24 +171,24 @@ EZPlot::do_cmd (int lx)
     o_linestyle = SGP::LS_SOLID;
     break;
   case S_DASH:
-    int ls;\r
-    ls = SGP::LS_DASH1;\r
-    if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) {\r
+    int ls;
+    ls = SGP::LS_DASH1;
+    if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) {
       if (n == 1)
         ls = SGP::LS_DASH1;
       else if (n == 2)
         ls = SGP::LS_DASH2;
       else if (n == 3)
         ls = SGP::LS_DASH3;
-      else if (n == 4)\r
-        ls = SGP::LS_DASH4;\r
-      else if (n == 5)\r
-        ls = SGP::LS_DOTTED;\r
-    }\r
-    if (m_iCurrentCurve < 0)\r
-      o_linestyle = ls;\r
-    else \r
-      setLinestyle (m_iCurrentCurve, ls);\r
+      else if (n == 4)
+        ls = SGP::LS_DASH4;
+      else if (n == 5)
+        ls = SGP::LS_DOTTED;
+    }
+    if (m_iCurrentCurve < 0)
+      o_linestyle = ls;
+    else 
+      setLinestyle (m_iCurrentCurve, ls);
     break;
   case S_NOLINE:
     o_linestyle = SGP::LS_NOLINE;
@@ -197,11 +197,11 @@ EZPlot::do_cmd (int lx)
   case S_COLOR:
     if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE)
     {
-      if (n >= 0) {\r
+      if (n >= 0) {
         if (m_iCurrentCurve < 0)
-          o_color = n;\r
-        else \r
-          setColor (m_iCurrentCurve, n);\r
+          o_color = n;
+        else 
+          setColor (m_iCurrentCurve, n);
       } else
         bad_option("The color you picked");
     }
@@ -283,36 +283,36 @@ EZPlot::do_cmd (int lx)
   case S_SYMBOL:
     if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) {
       if (n > 0 && n <= MAXSYMBOL) {
-        if (m_iCurrentCurve < 0)\r
-          o_symbol = n;\r
-        else\r
-          setSymbol (m_iCurrentCurve, n);\r
-      }\r
+        if (m_iCurrentCurve < 0)
+          o_symbol = n;
+        else
+          setSymbol (m_iCurrentCurve, n);
+      }
     } else {
       if (m_pol.readWord("every",5) == TRUE) {
-        if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) {\r
+        if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) {
           int sym = 1;
-          if (n > 0)\r
-            sym = n;\r
-          if (m_iCurrentCurve < 0)\r
-            o_symfreq = sym;\r
-          else \r
-            setSymbolFreq (m_iCurrentCurve, sym);\r
+          if (n > 0)
+            sym = n;
+          if (m_iCurrentCurve < 0)
+            o_symfreq = sym;
+          else 
+            setSymbolFreq (m_iCurrentCurve, sym);
         }
       } else if (m_pol.readWord ("none",4) == TRUE) {
         o_symbol = -1;
       }
     }
     break;
-  case S_CURVE:\r
-    if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) {\r
-      if (n > 0)\r
-        m_iCurrentCurve = n - 1;\r
-    } else {\r
-      if (m_pol.readWord ("all",3) == TRUE) \r
-        m_iCurrentCurve = -1;\r
-    }\r
-    break;\r
+  case S_CURVE:
+    if (m_pol.readInteger (&n, POL::TT_REAL, FALSE, 0, 0) == TRUE) {
+      if (n > 0)
+        m_iCurrentCurve = n - 1;
+    } else {
+      if (m_pol.readWord ("all",3) == TRUE) 
+        m_iCurrentCurve = -1;
+    }
+    break;
   case S_XTICKS:
     if (m_pol.readUserToken(str,&lx) == FALSE)
       break;
@@ -382,21 +382,21 @@ EZPlot::do_cmd (int lx)
 }
 
 
-\r
+
 void 
 EZPlot::bad_option (char *opt)
 {
   sys_error (ERR_WARNING, "INVALID option: %s", opt);
 }
-\r
+
 
 //----------------------------------------------------------------------
 //                     KEYWORDS / CODES TABLE
 //----------------------------------------------------------------------
-const struct KeywordCodeTable EZPlot::m_sKeywords[] =\r
-{\r
+const struct KeywordCodeTable EZPlot::m_sKeywords[] =
+{
   {"solid",    S_SOLID},
-  {"dash", S_DASH},\r
+  {"dash", S_DASH},
   {"curve", S_CURVE},
   {"noline",   S_NOLINE},
   {"black",    S_BLACK},
@@ -473,7 +473,7 @@ const struct KeywordCodeTable EZPlot::m_sKeywords[] =
   
   {"textsize", S_TEXTSIZE},
 };
-\r
+
 const int EZPlot::NKEYS = (sizeof(EZPlot::m_sKeywords) / sizeof (struct KeywordCodeTable));
 
 void 
index 9c0e4278b61b951e7490d9c9e0981eaddcaccfed..22741e3938df85c0de739eabe38460ea2d40e402 100644 (file)
@@ -6,7 +6,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: pol.cpp,v 1.8 2000/12/29 15:45:06 kevin Exp $
+**  $Id: pol.cpp,v 1.9 2001/01/02 16:02:13 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
@@ -22,7 +22,7 @@
 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ******************************************************************************/
 
-#include "ct.h"\r
+#include "ct.h"
 #include <math.h>
 #include <stdio.h>
 #include <ctype.h>
@@ -50,11 +50,11 @@ const struct POL::KeywordCodeList POL::cmdlist[] = {
 };
 
 const unsigned int POL::NUMCMD = (sizeof(POL::cmdlist) / sizeof (struct POL::KeywordCodeList));
-\r
+
 
 POL::POL()
 {
-  currentf = -1;\r
+  currentf = -1;
   m_bTrace = false;
   init();
 }
@@ -76,7 +76,7 @@ POL::init ()
   meta.ter    = PERCENT;
   meta.inb    = LBRACK;
   
-  m_bNewlineIsEOC = true;\r
+  m_bNewlineIsEOC = true;
   m_szSkipChars[0] = EOS;
   
   
@@ -85,7 +85,7 @@ POL::init ()
   
   token.ready = false;         // no token read yet 
 }
-\r
+
 
 /* addSkipWord (w)
 *
@@ -107,11 +107,11 @@ POL::addSkipWord (const char* const w)
 */
 void 
 POL::addSkipChar (int c)
-{\r
-  int n = strlen (m_szSkipChars);\r
-  if (n < MAXSKIPCHAR) {\r
-    m_szSkipChars[n] = c;\r
-    m_szSkipChars[n+1] = 0;\r
+{
+  int n = strlen (m_szSkipChars);
+  if (n < MAXSKIPCHAR) {
+    m_szSkipChars[n] = c;
+    m_szSkipChars[n+1] = 0;
   }
 }
 
@@ -122,7 +122,7 @@ POL::addSkipChar (int c)
 //
 // tok() looks for these user defined tokens.  If it finds one,
 // it stores the tokens code in the token structure and returns TT_USERTOK
-void\r
+void
 POL::addKeyword (const char* const str, int code)
 {
   usertable.installKeywordCode (str, code);
@@ -228,7 +228,7 @@ POL::readInteger (int *n, int typecode, bool boundcode, int bb1, int bb2)
   return (false);
 }
 
-bool\r
+bool
 POL::readFloat (double *n, double typecode, bool boundcode, double bb1, double bb2)
 {
   tok (&token);
@@ -275,7 +275,7 @@ POL::skipTokens()
   return (skipSingleToken (term));
 }
 
-void \r
+void 
 POL::reader()
 {
   while (skipTokens())
@@ -621,7 +621,7 @@ POL::getescape (    /* reads up to delim */
   }
   s[i] = EOS;
 }
-\r
+
 
 bool 
 POL::readText (char *str, int lim)
@@ -630,17 +630,17 @@ POL::readText (char *str, int lim)
   while ((c = inchar()) == BLANK || c == TAB)
     ;
   ungetch (c);
-  if (c == EOF) {\r
-    str[0] = 0;\r
-    return false;\r
-  }\r
-  \r
+  if (c == EOF) {
+    str[0] = 0;
+    return false;
+  }
+  
   int i;
   for (i = 0; i < lim && (c = inchar()) != EOF && c != NEWLINE; i++)
     str[i] = c;
   ungetch (c);
-  str[i] = 0;\r
-  \r
+  str[i] = 0;
+  
   return true;
 }
 
@@ -831,9 +831,9 @@ POL::usefile (int source, char *fn)
     sys_error (ERR_SEVERE, "files nested too deeply");
     return;
   }
-  \r
-  while (! m_stackPushBackInput.empty())\r
-    m_stackPushBackInput.pop();\r
+  
+  while (! m_stackPushBackInput.empty())
+    m_stackPushBackInput.pop();
 
   if (source == P_USE_STR) {
     filep[currentf] = NULL;
@@ -898,12 +898,12 @@ POL::inchar()
 int 
 POL::getch (FILE *fp)
 {
-  int c;\r
-  if (m_stackPushBackInput.size() > 0) {\r
-    c = m_stackPushBackInput.top();\r
-    m_stackPushBackInput.pop();\r
-    return c;\r
-  }\r
+  int c;
+  if (m_stackPushBackInput.size() > 0) {
+    c = m_stackPushBackInput.top();
+    m_stackPushBackInput.pop();
+    return c;
+  }
 
   if (fp == NULL) {
     if ((c = inputline[lineptr]) == EOS)
@@ -922,17 +922,17 @@ POL::getch (FILE *fp)
 void 
 POL::ungetch (int c)
 {
-  m_stackPushBackInput.push (c);\r
+  m_stackPushBackInput.push (c);
 }
 
 
 int 
 POL::get_inputline (FILE *fp)
 {
-  while (! m_stackPushBackInput.empty())\r
-    m_stackPushBackInput.pop();\r
-\r
-  lineptr = 0;\r
+  while (! m_stackPushBackInput.empty())
+    m_stackPushBackInput.pop();
+
+  lineptr = 0;
   if (fgets (inputline, MAXLINE, fp) == NULL)
     return (EOF);
   else
@@ -942,9 +942,9 @@ POL::get_inputline (FILE *fp)
 void 
 POL::set_inputline (const char* const line)
 {
-  while (! m_stackPushBackInput.empty())\r
-    m_stackPushBackInput.pop();\r
-\r
+  while (! m_stackPushBackInput.empty())
+    m_stackPushBackInput.pop();
+
   strncpy (inputline, line, MAXLINE);
-  lineptr = 0;\r
+  lineptr = 0;
 }
index a7450936dc65d30d27bcc87d541645bbacca99ce..ec129d211837fed5ef0b492f3431b113b36b7a84 100644 (file)
@@ -7,7 +7,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: sgp.cpp,v 1.24 2000/12/26 21:13:15 kevin Exp $
+**  $Id: sgp.cpp,v 1.25 2001/01/02 16:02:13 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
@@ -98,18 +98,18 @@ SGP::SGP (const SGPDriver& driver)
     static const double dScreenDPI = 82;
     static const double dPointsPerInch = 72.;
     m_dPointsPerPixel = dPointsPerInch / dScreenDPI;
-    const int iTestPointSize = 12;\r
+    const int iTestPointSize = 12;
     m_pFont = new wxFont (wxROMAN, wxNORMAL, wxNORMAL, wxNORMAL);
-    m_pFont->SetPointSize (iTestPointSize);\r
-    m_pFont->SetWeight (wxNORMAL);\r
+    m_pFont->SetPointSize (iTestPointSize);
+    m_pFont->SetWeight (wxNORMAL);
     m_pFont->SetStyle (wxNORMAL);
-    m_pFont->SetFamily (wxROMAN);\r
-#ifdef MSVC\r
-    m_pFont->SetFaceName(wxString("times new roman"));\r
-#endif\r
+    m_pFont->SetFamily (wxROMAN);
+#ifdef MSVC
+    m_pFont->SetFaceName(wxString("times new roman"));
+#endif
     m_driver.idWX()->SetFont (*m_pFont);
     double dTestCharHeight = m_driver.idWX()->GetCharHeight();
-    m_dPointsPerPixel = iTestPointSize / dTestCharHeight;\r
+    m_dPointsPerPixel = iTestPointSize / dTestCharHeight;
        m_driver.idWX()->SetBackground (*wxWHITE_BRUSH);
   }
 #endif
@@ -121,19 +121,19 @@ SGP::SGP (const SGPDriver& driver)
   
   setTextAngle (0.);
   setTextPointSize (12);
-  setColor (C_BLACK);\r
+  setColor (C_BLACK);
   setLineStyle (LS_SOLID);
 }
 
-SGP::~SGP()\r
-{\r
-#if HAVE_WXWINDOWS\r
-  if (m_driver.isWX()) {\r
-    m_driver.idWX()->SetFont (wxNullFont);\r
-    delete m_pFont;\r
-  }\r
-#endif\r
-}\r
+SGP::~SGP()
+{
+#if HAVE_WXWINDOWS
+  if (m_driver.isWX()) {
+    m_driver.idWX()->SetFont (wxNullFont);
+    delete m_pFont;
+  }
+#endif
+}
 
 void
 SGP::stylusNDC (double x, double y, bool beam)
@@ -179,19 +179,19 @@ SGP::eraseWindow ()
     g2_clear (m_driver.idG2());
 #endif
 #if HAVE_WXWINDOWS
-  if (m_driver.isWX()) {\r
-       wxBrush brushWhite;\r
-       brushWhite.SetColour(255,255,255);\r
-       m_driver.idWX()->SetBackground(brushWhite);\r
-       m_driver.idWX()->Clear();\r
-       m_driver.idWX()->SetBackground(wxNullBrush);\r
-#if 1\r
-       wxPen pen;\r
-       pen.SetColour(255,255,255);\r
-       m_driver.idWX()->SetBrush (brushWhite);\r
-       m_driver.idWX()->DrawRectangle (0, 0, m_iPhysicalXSize, m_iPhysicalYSize);\r
-       m_driver.idWX()->SetBrush (wxNullBrush);\r
-#endif\r
+  if (m_driver.isWX()) {
+       wxBrush brushWhite;
+       brushWhite.SetColour(255,255,255);
+       m_driver.idWX()->SetBackground(brushWhite);
+       m_driver.idWX()->Clear();
+       m_driver.idWX()->SetBackground(wxNullBrush);
+#if 1
+       wxPen pen;
+       pen.SetColour(255,255,255);
+       m_driver.idWX()->SetBrush (brushWhite);
+       m_driver.idWX()->DrawRectangle (0, 0, m_iPhysicalXSize, m_iPhysicalYSize);
+       m_driver.idWX()->SetBrush (wxNullBrush);
+#endif
   }
 #endif
 }
@@ -394,37 +394,37 @@ SGP::setMarker (int idMarke, int iColor)
 //==============================================================
 void 
 SGP::setLineStyle (int style)
-{\r
-  m_iLinestyle = style;\r
-
-#if HAVE_WXWINDOWS\r
-  if (m_driver.isWX()) {\r
-    switch (m_iLinestyle) {\r
-    case LS_SOLID:\r
-      m_pen.SetStyle (wxSOLID);\r
-      break;\r
-    case LS_DASH1:\r
-      m_pen.SetStyle (wxLONG_DASH);\r
-      break;\r
-    case LS_DASH2:\r
-      m_pen.SetStyle (wxSHORT_DASH);\r
-      break;\r
-    case LS_DASH3:\r
-      m_pen.SetStyle (wxDOT_DASH);\r
-      break;\r
-    case LS_DASH4:\r
-      m_pen.SetStyle (wxCROSS_HATCH);\r
-      break;\r
-    case LS_DOTTED:\r
-      m_pen.SetStyle (wxDOT);\r
-      break;\r
-    default:\r
-      m_pen.SetStyle (wxSOLID);\r
-      break;\r
-    }\r
-    m_driver.idWX()->SetPen (m_pen);\r
-  }\r
-#endif\r
+{
+  m_iLinestyle = style;
+
+#if HAVE_WXWINDOWS
+  if (m_driver.isWX()) {
+    switch (m_iLinestyle) {
+    case LS_SOLID:
+      m_pen.SetStyle (wxSOLID);
+      break;
+    case LS_DASH1:
+      m_pen.SetStyle (wxLONG_DASH);
+      break;
+    case LS_DASH2:
+      m_pen.SetStyle (wxSHORT_DASH);
+      break;
+    case LS_DASH3:
+      m_pen.SetStyle (wxDOT_DASH);
+      break;
+    case LS_DASH4:
+      m_pen.SetStyle (wxCROSS_HATCH);
+      break;
+    case LS_DOTTED:
+      m_pen.SetStyle (wxDOT);
+      break;
+    default:
+      m_pen.SetStyle (wxSOLID);
+      break;
+    }
+    m_driver.idWX()->SetPen (m_pen);
+  }
+#endif
 }
 
 //==============================================================
@@ -532,11 +532,11 @@ SGP::getTextExtent (const char* szText, double* worldW, double* worldH)
   if (m_driver.isWX()) {
     wxString sText (szText);
     wxCoord deviceW, deviceH;
-    m_driver.idWX()->GetTextExtent (sText, &deviceW, &deviceH);\r
-    if (m_dTextAngle == 90 || m_dTextAngle == -90) {\r
-      wxCoord temp = deviceW;\r
-      deviceW = deviceH;\r
-      deviceH = temp;\r
+    m_driver.idWX()->GetTextExtent (sText, &deviceW, &deviceH);
+    if (m_dTextAngle == 90 || m_dTextAngle == -90) {
+      wxCoord temp = deviceW;
+      deviceW = deviceH;
+      deviceH = temp;
     }
     *worldW = (xw_max - xw_min) * deviceW / static_cast<double>(m_iPhysicalXSize);;
     *worldH = (yw_max - yw_min) * deviceH / static_cast<double>(m_iPhysicalYSize);
@@ -552,7 +552,7 @@ SGP::getCharHeight ()
 #if HAVE_WXWINDOWS
   if (m_driver.isWX()) {
     dHeight = m_driver.idWX()->GetCharHeight();
-    dHeight /= static_cast<double>(m_iPhysicalYSize);\r
+    dHeight /= static_cast<double>(m_iPhysicalYSize);
        dHeight /= (yv_max - yv_min); // scale to viewport;
   }
 #endif
@@ -568,7 +568,7 @@ SGP::getCharWidth ()
 #if HAVE_WXWINDOWS
   if (m_driver.isWX()) {
     dWidth = m_driver.idWX()->GetCharWidth();
-    dWidth /= static_cast<double>(m_iPhysicalXSize);\r
+    dWidth /= static_cast<double>(m_iPhysicalXSize);
        dWidth /= (xv_max - xv_min); // scale to viewport
   }
 #endif
index 9edf3aaf65623ea2fab61cfe2ba5adad85e4ef05..ce27a3e598e3963757465578d17aba11c4c8cc64 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: transformmatrix.cpp,v 1.3 2000/12/06 01:46:43 kevin Exp $
+**  $Id: transformmatrix.cpp,v 1.4 2001/01/02 16:02:13 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
 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ******************************************************************************/
 
-#include <iostream>\r
+#include <iostream>
 #include "ctsupport.h"
 #include "transformmatrix.h"
-\r
+
 
 TransformationMatrix2D::TransformationMatrix2D (double m[3][3])
 {
@@ -92,8 +92,8 @@ TransformationMatrix2D::invert () const
 
   double determ = determinant ();
   if (fabs(determ) < 1E-6) {
-    sys_error (ERR_WARNING, "Determinant = %g [TransformationMatrix2D::invert]", determ);\r
-       print (std::cout);\r
+    sys_error (ERR_WARNING, "Determinant = %g [TransformationMatrix2D::invert]", determ);
+       print (std::cout);
        std::cout << std::endl;
   }
 
index 49f90f45182c30c656ee2bdb17162cce4e01a059..555d22eed1b9c771fdfb92d2e2c37fef87c5094a 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: array2dfile.cpp,v 1.26 2001/01/02 07:47:36 kevin Exp $
+**  $Id: array2dfile.cpp,v 1.27 2001/01/02 16:02:13 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
@@ -26,9 +26,9 @@
 ******************************************************************************/
 
 #include "array2dfile.h"
-#include <ctime>\r
-#ifdef MSVC\r
-typedef long off_t;\r
+#include <ctime>
+#ifdef MSVC
+typedef long off_t;
 #endif
 
 
@@ -108,8 +108,8 @@ Array2dFileLabel::getDateTime (int& year, int& month, int& day, int& hour, int&
 const std::string& 
 Array2dFileLabel::getDateString (void) const
 {
-  char szDate [128];\r
-  snprintf (szDate, sizeof(szDate), "%2d/%02d/%4d %02d:%02d:%02d",\r
+  char szDate [128];
+  snprintf (szDate, sizeof(szDate), "%2d/%02d/%4d %02d:%02d:%02d",
     m_month + 1, m_day, m_year + 1900, m_hour, m_minute, m_second);
   m_strDate = szDate;
   return m_strDate;
@@ -137,53 +137,53 @@ Array2dFileLabel::operator= (const Array2dFileLabel& rhs)
   return (*this);
 }
 
-void\r
-Array2dFileLabel::print (std::ostream& os) const\r
-{\r
-  if (m_labelType == L_HISTORY) {\r
-    os << "History: " << std::endl;\r
-    os << "  " << m_strLabel << std::endl;\r
-    os << "  calc time = " << m_calcTime << " secs" << std::endl;\r
-    os << "  Timestamp = " << getDateString() << std::endl;\r
-  } else if (m_labelType == L_USER) {\r
-    os << "Note: " <<  m_strLabel << std::endl;\r
-    os << "  Timestamp = %s" << getDateString() << std::endl;\r
-  } else {\r
-    os << "Unknown (" << m_labelType << "): " <<  m_strLabel << std::endl;\r
-    os << "  Timestamp = %s" << getDateString() << std::endl;\r
-  }\r
-}\r
-\r
-void\r
-Array2dFileLabel::printBrief (std::ostream& os) const\r
-{\r
-  if (m_labelType == L_HISTORY) {\r
-    os << "History (";\r
-    if (m_calcTime > 0)\r
-      os << m_calcTime << " secs, ";\r
-    os << getDateString() << "): " << m_strLabel << std::endl;\r
-  } else if (m_labelType == L_USER) {\r
-    os << "Note (" <<  getDateString() << "): " << m_strLabel << std::endl;\r
-  } else {\r
-    os << "Unknown (" << getDateString() << "): " << m_strLabel << std::endl;\r
-  }\r
-}\r
-
-void\r
-Array2dFileLabel::printBrief (std::ostringstream& os) const\r
-{\r
-  if (m_labelType == L_HISTORY) {\r
-    os << "History (";\r
-    if (m_calcTime > 0)\r
-      os << m_calcTime << " secs, ";\r
+void
+Array2dFileLabel::print (std::ostream& os) const
+{
+  if (m_labelType == L_HISTORY) {
+    os << "History: " << std::endl;
+    os << "  " << m_strLabel << std::endl;
+    os << "  calc time = " << m_calcTime << " secs" << std::endl;
+    os << "  Timestamp = " << getDateString() << std::endl;
+  } else if (m_labelType == L_USER) {
+    os << "Note: " <<  m_strLabel << std::endl;
+    os << "  Timestamp = %s" << getDateString() << std::endl;
+  } else {
+    os << "Unknown (" << m_labelType << "): " <<  m_strLabel << std::endl;
+    os << "  Timestamp = %s" << getDateString() << std::endl;
+  }
+}
+
+void
+Array2dFileLabel::printBrief (std::ostream& os) const
+{
+  if (m_labelType == L_HISTORY) {
+    os << "History (";
+    if (m_calcTime > 0)
+      os << m_calcTime << " secs, ";
+    os << getDateString() << "): " << m_strLabel << std::endl;
+  } else if (m_labelType == L_USER) {
+    os << "Note (" <<  getDateString() << "): " << m_strLabel << std::endl;
+  } else {
+    os << "Unknown (" << getDateString() << "): " << m_strLabel << std::endl;
+  }
+}
+
+void
+Array2dFileLabel::printBrief (std::ostringstream& os) const
+{
+  if (m_labelType == L_HISTORY) {
+    os << "History (";
+    if (m_calcTime > 0)
+      os << m_calcTime << " secs, ";
     os << getDateString().c_str() << "): " << m_strLabel.c_str() << "\n";
-  } else if (m_labelType == L_USER) {\r
+  } else if (m_labelType == L_USER) {
     os << "Note (" <<  getDateString() << "): " << m_strLabel << "\n";
-  } else {\r
+  } else {
     os << "Unknown (" << getDateString() << "): " << m_strLabel << "\n";
-  }\r
-}\r
-\r
+  }
+}
+
 
 ///////////////////////////////////////////////////////////////////////////
 // CLASS IMPLEMENTATION
@@ -216,8 +216,8 @@ Array2dFile::init (void)
 {
   m_pixelSize = 0;
   m_pixelFormat = PIXEL_INVALID;
-  m_arrayData = NULL;\r
-  m_imaginaryArrayData = NULL;\r
+  m_arrayData = NULL;
+  m_imaginaryArrayData = NULL;
   m_dataType = DATA_TYPE_INVALID;
   m_nx = 0;
   m_ny = 0;
@@ -235,7 +235,7 @@ void
 Array2dFile::setArraySize (int x, int y, int pixelSize, int pixelFormat, int dataType)
 {
   m_pixelSize = pixelSize;
-  m_pixelFormat = pixelFormat;\r
+  m_pixelFormat = pixelFormat;
   m_dataType = dataType;
   setArraySize (x, y);
 }
@@ -246,78 +246,78 @@ Array2dFile::setArraySize (int x, int y)
   m_nx = x;
   m_ny = y;
   allocArrays ();
-}\r
-\r
-bool\r
-Array2dFile::reallocComplexToReal ()\r
-{\r
-  if (m_dataType != DATA_TYPE_COMPLEX)\r
-    return false;\r
-\r
-  freeArray (m_imaginaryArrayData);\r
-  m_dataType = DATA_TYPE_REAL;\r
-\r
-  return true;\r
-}\r
-\r
-\r
-bool\r
-Array2dFile::reallocRealToComplex ()\r
-{\r
-  if (m_dataType != DATA_TYPE_REAL)\r
-    return false;\r
-\r
-  allocArray (m_imaginaryArrayData);\r
-  m_dataType = DATA_TYPE_COMPLEX;\r
-\r
-  return true;\r
-}\r
-\r
+}
+
+bool
+Array2dFile::reallocComplexToReal ()
+{
+  if (m_dataType != DATA_TYPE_COMPLEX)
+    return false;
+
+  freeArray (m_imaginaryArrayData);
+  m_dataType = DATA_TYPE_REAL;
+
+  return true;
+}
+
+
+bool
+Array2dFile::reallocRealToComplex ()
+{
+  if (m_dataType != DATA_TYPE_REAL)
+    return false;
+
+  allocArray (m_imaginaryArrayData);
+  m_dataType = DATA_TYPE_COMPLEX;
+
+  return true;
+}
+
 
 
 void 
 Array2dFile::allocArrays ()
 {
-  if (m_arrayData) \r
-    freeArray (m_arrayData);\r
-  if (m_imaginaryArrayData)\r
-    freeArray (m_imaginaryArrayData);\r
-\r
-  allocArray (m_arrayData);\r
-  if (m_dataType == DATA_TYPE_COMPLEX)\r
-    allocArray (m_imaginaryArrayData);\r
-}\r
-\r
-void\r
-Array2dFile::allocArray (unsigned char**& rppData)\r
-{\r
+  if (m_arrayData) 
+    freeArray (m_arrayData);
+  if (m_imaginaryArrayData)
+    freeArray (m_imaginaryArrayData);
+
+  allocArray (m_arrayData);
+  if (m_dataType == DATA_TYPE_COMPLEX)
+    allocArray (m_imaginaryArrayData);
+}
+
+void
+Array2dFile::allocArray (unsigned char**& rppData)
+{
   m_arraySize = m_nx * m_ny * m_pixelSize;
-  rppData = new unsigned char* [m_nx];\r
+  rppData = new unsigned char* [m_nx];
   int columnBytes = m_ny * m_pixelSize;
   for (unsigned int i = 0; i < m_nx; i++)
-    rppData[i] = new unsigned char [columnBytes];\r
+    rppData[i] = new unsigned char [columnBytes];
 }
 
 void 
 Array2dFile::freeArrays ()
 {
-  if (m_arrayData) \r
-    freeArray (m_arrayData);\r
-  \r
-  if (m_imaginaryArrayData) \r
-    freeArray (m_imaginaryArrayData);\r
-  \r
-}\r
-\r
-void\r
-Array2dFile::freeArray (unsigned char**& rppData)\r
-{\r
-   for (unsigned int i = 0; i < m_nx; i++)\r
-      delete rppData[i];\r
-    delete rppData;\r
-    rppData = NULL;\r
-}\r
-\r
+  if (m_arrayData) 
+    freeArray (m_arrayData);
+  
+  if (m_imaginaryArrayData) 
+    freeArray (m_imaginaryArrayData);
+  
+}
+
+void
+Array2dFile::freeArray (unsigned char**& rppData)
+{
+   for (unsigned int i = 0; i < m_nx; i++)
+      delete rppData[i];
+    delete rppData;
+    rppData = NULL;
+}
+
 
 bool
 Array2dFile::fileWrite (const std::string& filename)
@@ -358,11 +358,11 @@ Array2dFile::fileRead (const char* const filename)
 {
   m_filename = filename;
   
-#ifdef MSVC\r
-  frnetorderstream fs (m_filename.c_str(), std::ios::out | std::ios::in | std::ios::binary);\r
-#else\r
-  frnetorderstream fs (m_filename.c_str(), std::ios::out | std::ios::in | std::ios::binary | std::ios::nocreate);\r
-#endif\r
+#ifdef MSVC
+  frnetorderstream fs (m_filename.c_str(), std::ios::out | std::ios::in | std::ios::binary);
+#else
+  frnetorderstream fs (m_filename.c_str(), std::ios::out | std::ios::in | std::ios::binary | std::ios::nocreate);
+#endif
   if (fs.fail()) {
     sys_error (ERR_WARNING, "Unable to open file %s [fileRead]", m_filename.c_str());
     return false;
@@ -417,7 +417,7 @@ Array2dFile::headerRead (frnetorderstream& fs)
   fs.readInt16 (m_pixelSize);
   fs.readInt16 (m_numFileLabels);
   fs.readInt32 (m_nx);
-  fs.readInt32 (m_ny);\r
+  fs.readInt32 (m_ny);
   fs.readInt16 (m_dataType);
   fs.readInt16 (m_axisIncrementKnown);
   fs.readFloat64 (m_axisIncrementX);
@@ -461,7 +461,7 @@ Array2dFile::headerWrite (frnetorderstream& fs)
   fs.writeInt16 (m_pixelSize);
   fs.writeInt16 (m_numFileLabels);
   fs.writeInt32 (m_nx);
-  fs.writeInt32 (m_ny);\r
+  fs.writeInt32 (m_ny);
   fs.writeInt16 (m_dataType);
   fs.writeInt16 (m_axisIncrementKnown);
   fs.writeFloat64 (m_axisIncrementX);
@@ -495,30 +495,30 @@ Array2dFile::arrayDataWrite (frnetorderstream& fs)
   
   fs.seekp (m_headersize);
   int columnSize = m_ny * m_pixelSize;
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    unsigned char* ptrColumn = m_arrayData[ix];\r
-    if (NativeBigEndian()) {\r
-      for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-        ConvertReverseNetworkOrder (ptrColumn, m_pixelSize);\r
-        fs.write (reinterpret_cast<const char*>(ptrColumn), m_pixelSize);\r
-        ptrColumn += m_pixelSize;\r
-      }\r
-    } else \r
-      fs.write (reinterpret_cast<const char*>(ptrColumn), columnSize);\r
-  }\r
-  if (m_dataType == DATA_TYPE_COMPLEX) {\r
-    for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-      unsigned char* ptrColumn = m_imaginaryArrayData[ix];\r
-      if (NativeBigEndian()) {\r
-        for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-          ConvertReverseNetworkOrder (ptrColumn, m_pixelSize);\r
-          fs.write (reinterpret_cast<const char*>(ptrColumn), m_pixelSize);\r
-          ptrColumn += m_pixelSize;\r
-        }\r
-      } else \r
-        fs.write (reinterpret_cast<const char*>(ptrColumn), columnSize);\r
-    }\r
-  }\r
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    unsigned char* ptrColumn = m_arrayData[ix];
+    if (NativeBigEndian()) {
+      for (unsigned int iy = 0; iy < m_ny; iy++) {
+        ConvertReverseNetworkOrder (ptrColumn, m_pixelSize);
+        fs.write (reinterpret_cast<const char*>(ptrColumn), m_pixelSize);
+        ptrColumn += m_pixelSize;
+      }
+    } else 
+      fs.write (reinterpret_cast<const char*>(ptrColumn), columnSize);
+  }
+  if (m_dataType == DATA_TYPE_COMPLEX) {
+    for (unsigned int ix = 0; ix < m_nx; ix++) {
+      unsigned char* ptrColumn = m_imaginaryArrayData[ix];
+      if (NativeBigEndian()) {
+        for (unsigned int iy = 0; iy < m_ny; iy++) {
+          ConvertReverseNetworkOrder (ptrColumn, m_pixelSize);
+          fs.write (reinterpret_cast<const char*>(ptrColumn), m_pixelSize);
+          ptrColumn += m_pixelSize;
+        }
+      } else 
+        fs.write (reinterpret_cast<const char*>(ptrColumn), columnSize);
+    }
+  }
   
   return true;
 }
@@ -537,30 +537,30 @@ Array2dFile::arrayDataRead (frnetorderstream& fs)
   
   fs.seekg (m_headersize);
   int columnSize = m_ny * m_pixelSize;
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    unsigned char* ptrColumn = m_arrayData[ix];\r
-    if (NativeBigEndian()) {\r
-      for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-        fs.read (reinterpret_cast<char*>(ptrColumn), m_pixelSize);\r
-        ConvertReverseNetworkOrder (ptrColumn, m_pixelSize);\r
-        ptrColumn += m_pixelSize;\r
-      } \r
-    } else\r
-      fs.read (reinterpret_cast<char*>(ptrColumn), columnSize);\r
-  }\r
-  if (m_dataType == DATA_TYPE_COMPLEX) {\r
-    for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-      unsigned char* ptrColumn = m_imaginaryArrayData[ix];\r
-      if (NativeBigEndian()) {\r
-        for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-          fs.read (reinterpret_cast<char*>(ptrColumn), m_pixelSize);\r
-          ConvertReverseNetworkOrder (ptrColumn, m_pixelSize);\r
-          ptrColumn += m_pixelSize;\r
-        } \r
-      } else\r
-        fs.read (reinterpret_cast<char*>(ptrColumn), columnSize);\r
-    }\r
-  }\r
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    unsigned char* ptrColumn = m_arrayData[ix];
+    if (NativeBigEndian()) {
+      for (unsigned int iy = 0; iy < m_ny; iy++) {
+        fs.read (reinterpret_cast<char*>(ptrColumn), m_pixelSize);
+        ConvertReverseNetworkOrder (ptrColumn, m_pixelSize);
+        ptrColumn += m_pixelSize;
+      } 
+    } else
+      fs.read (reinterpret_cast<char*>(ptrColumn), columnSize);
+  }
+  if (m_dataType == DATA_TYPE_COMPLEX) {
+    for (unsigned int ix = 0; ix < m_nx; ix++) {
+      unsigned char* ptrColumn = m_imaginaryArrayData[ix];
+      if (NativeBigEndian()) {
+        for (unsigned int iy = 0; iy < m_ny; iy++) {
+          fs.read (reinterpret_cast<char*>(ptrColumn), m_pixelSize);
+          ConvertReverseNetworkOrder (ptrColumn, m_pixelSize);
+          ptrColumn += m_pixelSize;
+        } 
+      } else
+        fs.read (reinterpret_cast<char*>(ptrColumn), columnSize);
+    }
+  }
   
   return true;
 }
@@ -593,10 +593,10 @@ Array2dFile::labelsRead (frnetorderstream& fs)
     pszLabelStr[strLength] = 0;
     
     Array2dFileLabel* pLabel = new Array2dFileLabel (labelType, pszLabelStr, calcTime);
-    delete pszLabelStr;\r
-    \r
+    delete pszLabelStr;
+    
     pLabel->setDateTime (year, month, day, hour, minute, second);
-    m_labels.push_back (pLabel);\r
+    m_labels.push_back (pLabel);
   }
   
   return true;
@@ -678,49 +678,49 @@ Array2dFile::labelsCopy (const Array2dFile& copyFile, const char* const pszId)
 void 
 Array2dFile::arrayDataClear (void)
 {
-  if (m_arrayData) {\r
-    int columnSize = m_ny * m_pixelSize;\r
-    for (unsigned int ix = 0; ix < m_nx; ix++)\r
-      memset (m_arrayData[ix], 0, columnSize);\r
-  }\r
-  if (m_imaginaryArrayData) {\r
-    int columnSize = m_ny * m_pixelSize;\r
-    for (unsigned int ix = 0; ix < m_nx; ix++)\r
-      memset (m_arrayData[ix], 0, columnSize);\r
-  }\r
-}
-
-void\r
-Array2dFile::printLabels (std::ostream& os) const\r
-{\r
-  for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) {\r
-    const Array2dFileLabel& label = **l;\r
-    \r
-    label.print (os);\r
-    os << std::endl;\r
-  }\r
-}\r
-\r
-void\r
-Array2dFile::printLabelsBrief (std::ostream& os) const\r
-{\r
-  for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) {\r
-    const Array2dFileLabel& label = **l;\r
-    \r
-    label.printBrief (os);\r
-  }\r
-}\r
-\r
+  if (m_arrayData) {
+    int columnSize = m_ny * m_pixelSize;
+    for (unsigned int ix = 0; ix < m_nx; ix++)
+      memset (m_arrayData[ix], 0, columnSize);
+  }
+  if (m_imaginaryArrayData) {
+    int columnSize = m_ny * m_pixelSize;
+    for (unsigned int ix = 0; ix < m_nx; ix++)
+      memset (m_arrayData[ix], 0, columnSize);
+  }
+}
+
 void
-Array2dFile::printLabelsBrief (std::ostringstream& os) const\r
-{\r
-  for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) {\r
-    const Array2dFileLabel& label = **l;\r
-    \r
-    label.printBrief (os);\r
-  }\r
-}\r
-\r
+Array2dFile::printLabels (std::ostream& os) const
+{
+  for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) {
+    const Array2dFileLabel& label = **l;
+    
+    label.print (os);
+    os << std::endl;
+  }
+}
+
+void
+Array2dFile::printLabelsBrief (std::ostream& os) const
+{
+  for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) {
+    const Array2dFileLabel& label = **l;
+    
+    label.printBrief (os);
+  }
+}
+
+void
+Array2dFile::printLabelsBrief (std::ostringstream& os) const
+{
+  for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) {
+    const Array2dFileLabel& label = **l;
+    
+    label.printBrief (os);
+  }
+}
+
 
 const Array2dFileLabel&
 Array2dFile::labelGet (int i) const
index 726e5b8d30189c14e472f5e4eee802930742964e..1f8a1d21b0a04a7ae0390541be950e8c603239e8 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: backprojectors.cpp,v 1.21 2001/01/01 10:14:34 kevin Exp $
+**  $Id: backprojectors.cpp,v 1.22 2001/01/02 16:02:13 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
@@ -264,12 +264,12 @@ Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType
   iDetCenter = (nDet - 1) / 2; // index refering to L=0 projection 
   rotScale = proj.rotInc();
 
-  if (proj.geometry() == Scanner::GEOMETRY_PARALLEL)\r
-       rotScale /= (proj.nView() * proj.rotInc() / PI); // scale by number of PI rotations\r
-  else if (proj.geometry() == Scanner::GEOMETRY_EQUIANGULAR || proj.geometry() == Scanner::GEOMETRY_EQUILINEAR)\r
-       rotScale /= (proj.nView() * proj.rotInc() / (2 * PI)); // scale by number of 2PI rotations\r
-  else\r
-         sys_error (ERR_SEVERE, "Invalid geometry type %d [Backproject::Backproject]", proj.geometry());\r
+  if (proj.geometry() == Scanner::GEOMETRY_PARALLEL)
+       rotScale /= (proj.nView() * proj.rotInc() / PI); // scale by number of PI rotations
+  else if (proj.geometry() == Scanner::GEOMETRY_EQUIANGULAR || proj.geometry() == Scanner::GEOMETRY_EQUILINEAR)
+       rotScale /= (proj.nView() * proj.rotInc() / (2 * PI)); // scale by number of 2PI rotations
+  else
+         sys_error (ERR_SEVERE, "Invalid geometry type %d [Backproject::Backproject]", proj.geometry());
 
   v = im.getArray();
   nx = im.nx();
@@ -305,7 +305,7 @@ void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, doubl
 }
 
 void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double L, int iDetPos)
-{\r
+{
 #if 1
   std::ostringstream os;
   os << "ix=" << ix << ", iy=" << iy << ", theta=" << theta << ", L=" << L << ", detinc=" << detInc << "\n";
@@ -314,7 +314,7 @@ void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, doubl
   os << "yMin=" << yMin << ", yMax=" << yMax << ", yInc=" << yInc << "\n";
   os << "iDetPos index outside bounds: " << iDetPos << " [backprojector]";;
 
-  sys_error (ERR_WARNING, os.str().c_str());\r
+  sys_error (ERR_WARNING, os.str().c_str());
 #endif
 }
 
@@ -639,8 +639,8 @@ BackprojectIntDiff3::BackprojectView (const double* const filteredProj, const do
          *pImCol++ += filteredProj[iDetPos] + (detRemainder * deltaFilteredProj[iDetPos]);
       }        // end for iy
     } //end linear
-  } // end for ix\r
-\r
+  } // end for ix
+
   delete deltaFilteredProj;
 }
 
index 5a4b0ef5fdccb6889b8b5012fb11a474c9f93630..60f97c8e9b7f27319a3fc1a0dcb088f06e360b00 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: filter.cpp,v 1.32 2000/12/04 19:50:57 kevin Exp $
+**  $Id: filter.cpp,v 1.33 2001/01/02 16:02:13 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
@@ -369,7 +369,7 @@ SignalFilter::spatialResponseCalc (int filterID, double bw, double x, double par
     q[i] = frequencyResponse (filterID, bw, z, param) * cos (TWOPI * z * x);
   
   double y = 2 * integrateSimpson (zmin, zmax, q, n);
-  delete q;\r
+  delete q;
 
   return (y);
 }
index 09033acd3cecb1ad1478738f244256f0194b2353..08940d43636881e2db2d632b09ccfba95fae1ac3 100644 (file)
-/*****************************************************************************\r
-** FILE IDENTIFICATION\r
-**\r
-**   Name:          fourier.cpp\r
-**   Purpose:       Fourier transform functions\r
-**   Programmer:    Kevin Rosenberg\r
-**   Date Started:  Dec 2000\r
-**\r
-**  This is part of the CTSim program\r
-**  Copyright (C) 1983-2001 Kevin Rosenberg\r
-**\r
-**  $Id: fourier.cpp,v 1.1 2001/01/02 06:33:04 kevin Exp $\r
-**\r
-**  This program is free software; you can redistribute it and/or modify\r
-**  it under the terms of the GNU General Public License (version 2) as\r
-**  published by the Free Software Foundation.\r
-**\r
-**  This program is distributed in the hope that it will be useful,\r
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-**  GNU General Public License for more details.\r
-**\r
-**  You should have received a copy of the GNU General Public License\r
-**  along with this program; if not, write to the Free Software\r
-**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-******************************************************************************/\r
-\r
-#include "ct.h"\r
-\r
-\r
-\r
-void\r
-Fourier::shuffleFourierToNaturalOrder (ImageFile& im)\r
-{\r
-  ImageFileArray vReal = im.getArray();\r
-  ImageFileArray vImag = im.getImaginaryArray();\r
-  unsigned int ix, iy;\r
-  unsigned int nx = im.nx();\r
-  unsigned int ny = im.ny();\r
-\r
-  // shuffle each column\r
-  for (ix = 0; ix < nx; ix++) {\r
-    Fourier::shuffleFourierToNaturalOrder (vReal[ix], ny);\r
-    if (im.isComplex())\r
-      Fourier::shuffleFourierToNaturalOrder (vImag[ix], ny);\r
-  }\r
-\r
-  // shuffle each row\r
-  float* pRow = new float [nx];\r
-  for (iy = 0; iy < ny; iy++) {\r
-    for (ix = 0; ix < nx; ix++)\r
-      pRow[ix] = vReal[ix][iy];\r
-    Fourier::shuffleFourierToNaturalOrder (pRow, nx);\r
-    for (ix = 0; ix < nx; ix++)\r
-      vReal[ix][iy] = pRow[ix];\r
-    if (im.isComplex()) {\r
-      for (ix = 0; ix < nx; ix++)\r
-        pRow[ix] = vImag[ix][iy];\r
-      Fourier::shuffleFourierToNaturalOrder (pRow, nx);;\r
-      for (ix = 0; ix < nx; ix++)\r
-        vImag[ix][iy] = pRow[ix];\r
-    }\r
-  }\r
-  delete pRow;\r
-}\r
\r
-void\r
-Fourier::shuffleNaturalToFourierOrder (ImageFile& im)\r
-{\r
-  ImageFileArray vReal = im.getArray();\r
-  ImageFileArray vImag = im.getImaginaryArray();\r
-  unsigned int ix, iy;\r
-  unsigned int nx = im.nx();\r
-  unsigned int ny = im.ny();\r
-\r
-  // shuffle each x column\r
-  for (ix = 0; ix < nx; ix++) {\r
-    Fourier::shuffleNaturalToFourierOrder (vReal[ix], ny);\r
-    if (im.isComplex())\r
-      Fourier::shuffleNaturalToFourierOrder (vImag[ix], ny);\r
-  }\r
-\r
-  // shuffle each y row\r
-  float* pRow = new float [nx];\r
-  for (iy = 0; iy < ny; iy++) {\r
-    for (ix = 0; ix < nx; ix++)\r
-      pRow[ix] = vReal[ix][iy];\r
-    Fourier::shuffleNaturalToFourierOrder (pRow, nx);\r
-    for (ix = 0; ix < nx; ix++)\r
-      vReal[ix][iy] = pRow[ix];\r
-    if (im.isComplex()) {\r
-      for (ix = 0; ix < nx; ix++)\r
-        pRow[ix] = vImag[ix][iy];\r
-      Fourier::shuffleNaturalToFourierOrder (pRow, nx);\r
-      for (ix = 0; ix < nx; ix++)\r
-        vImag[ix][iy] = pRow[ix];\r
-    }\r
-  }\r
-  delete [] pRow;\r
-}\r
-\r
\r
-// Odd Number of Points\r
-//   Natural Frequency Order: -(n-1)/2...-1,0,1...(n-1)/2\r
-//   Fourier Frequency Order: 0, 1..(n-1)/2,-(n-1)/2...-1\r
-// Even Number of Points\r
-//   Natural Frequency Order: -n/2...-1,0,1...((n/2)-1)\r
-//   Fourier Frequency Order: 0,1...((n/2)-1),-n/2...-1\r
-\r
-void\r
-Fourier::shuffleNaturalToFourierOrder (double* pdVector, const int n)\r
-{\r
-  double* pdTemp = new 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 - 1; i++)\r
-      pdTemp[i + 1] = pdVector[i + iHalfN + 1];\r
-    for (i = 0; i < iHalfN; i++)\r
-      pdTemp[i + iHalfN] = pdVector[i];\r
-  }\r
-  \r
-  for (i = 0; i < n; i++)\r
-    pdVector[i] = pdTemp[i];\r
-  delete pdTemp;\r
-}\r
-\r
-void\r
-Fourier::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 - 1; i++)\r
-      pdTemp[i + 1] = pdVector[i + iHalfN + 1];\r
-    for (i = 0; i < iHalfN; i++)\r
-      pdTemp[i + iHalfN] = pdVector[i];\r
-  }\r
-  \r
-  for (i = 0; i < n; i++)\r
-    pdVector[i] = pdTemp[i];\r
-  delete [] pdTemp;\r
-}\r
-\r
-\r
-void\r
-Fourier::shuffleNaturalToFourierOrder (float* pdVector, const int n)\r
-{\r
-  float* pdTemp = new float [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 - 1; i++)\r
-      pdTemp[i + 1] = pdVector[i + iHalfN + 1];\r
-    for (i = 0; i < iHalfN; i++)\r
-      pdTemp[i + iHalfN] = pdVector[i];\r
-  }\r
-  \r
-  for (i = 0; i < n; i++)\r
-    pdVector[i] = pdTemp[i];\r
-  delete pdTemp;\r
-}\r
-\r
-\r
-\r
-void\r
-Fourier::shuffleFourierToNaturalOrder (double* pdVector, const int n)\r
-{\r
-  double* pdTemp = new 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
-\r
-void\r
-Fourier::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
-\r
-\r
-\r
-void\r
-Fourier::shuffleFourierToNaturalOrder (float* pVector, const int n)\r
-{\r
-  float* pTemp = new float [n];\r
-  int i;\r
-  if (n % 2) { // Odd\r
-    int iHalfN = (n - 1) / 2;\r
-    \r
-    pTemp[iHalfN] = pVector[0];\r
-    for (i = 0; i < iHalfN; i++)\r
-      pTemp[i + 1 + iHalfN] = pVector[i + 1];\r
-    for (i = 0; i < iHalfN; i++)\r
-      pTemp[i] = pVector[i + iHalfN + 1];\r
-  } else {     // Even\r
-    int iHalfN = n / 2;\r
-    pTemp[iHalfN] = pVector[0];\r
-    for (i = 0; i < iHalfN; i++)\r
-      pTemp[i] = pVector[i + iHalfN];\r
-    for (i = 0; i < iHalfN - 1; i++)\r
-      pTemp[i + iHalfN + 1] = pVector[i+1];\r
-  }\r
-  \r
-  for (i = 0; i < n; i++)\r
-    pVector[i] = pTemp[i];\r
-  delete [] pTemp;\r
-}\r
-\r
-\r
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+**   Name:          fourier.cpp
+**   Purpose:       Fourier transform functions
+**   Programmer:    Kevin Rosenberg
+**   Date Started:  Dec 2000
+**
+**  This is part of the CTSim program
+**  Copyright (C) 1983-2001 Kevin Rosenberg
+**
+**  $Id: fourier.cpp,v 1.2 2001/01/02 16:02:13 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
+**  published by the Free Software Foundation.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+******************************************************************************/
+
+#include "ct.h"
+
+
+
+void
+Fourier::shuffleFourierToNaturalOrder (ImageFile& im)
+{
+  ImageFileArray vReal = im.getArray();
+  ImageFileArray vImag = im.getImaginaryArray();
+  unsigned int ix, iy;
+  unsigned int nx = im.nx();
+  unsigned int ny = im.ny();
+
+  // shuffle each column
+  for (ix = 0; ix < nx; ix++) {
+    Fourier::shuffleFourierToNaturalOrder (vReal[ix], ny);
+    if (im.isComplex())
+      Fourier::shuffleFourierToNaturalOrder (vImag[ix], ny);
+  }
+
+  // shuffle each row
+  float* pRow = new float [nx];
+  for (iy = 0; iy < ny; iy++) {
+    for (ix = 0; ix < nx; ix++)
+      pRow[ix] = vReal[ix][iy];
+    Fourier::shuffleFourierToNaturalOrder (pRow, nx);
+    for (ix = 0; ix < nx; ix++)
+      vReal[ix][iy] = pRow[ix];
+    if (im.isComplex()) {
+      for (ix = 0; ix < nx; ix++)
+        pRow[ix] = vImag[ix][iy];
+      Fourier::shuffleFourierToNaturalOrder (pRow, nx);;
+      for (ix = 0; ix < nx; ix++)
+        vImag[ix][iy] = pRow[ix];
+    }
+  }
+  delete pRow;
+}
+void
+Fourier::shuffleNaturalToFourierOrder (ImageFile& im)
+{
+  ImageFileArray vReal = im.getArray();
+  ImageFileArray vImag = im.getImaginaryArray();
+  unsigned int ix, iy;
+  unsigned int nx = im.nx();
+  unsigned int ny = im.ny();
+
+  // shuffle each x column
+  for (ix = 0; ix < nx; ix++) {
+    Fourier::shuffleNaturalToFourierOrder (vReal[ix], ny);
+    if (im.isComplex())
+      Fourier::shuffleNaturalToFourierOrder (vImag[ix], ny);
+  }
+
+  // shuffle each y row
+  float* pRow = new float [nx];
+  for (iy = 0; iy < ny; iy++) {
+    for (ix = 0; ix < nx; ix++)
+      pRow[ix] = vReal[ix][iy];
+    Fourier::shuffleNaturalToFourierOrder (pRow, nx);
+    for (ix = 0; ix < nx; ix++)
+      vReal[ix][iy] = pRow[ix];
+    if (im.isComplex()) {
+      for (ix = 0; ix < nx; ix++)
+        pRow[ix] = vImag[ix][iy];
+      Fourier::shuffleNaturalToFourierOrder (pRow, nx);
+      for (ix = 0; ix < nx; ix++)
+        vImag[ix][iy] = pRow[ix];
+    }
+  }
+  delete [] pRow;
+}
+
+// Odd Number of Points
+//   Natural Frequency Order: -(n-1)/2...-1,0,1...(n-1)/2
+//   Fourier Frequency Order: 0, 1..(n-1)/2,-(n-1)/2...-1
+// Even Number of Points
+//   Natural Frequency Order: -n/2...-1,0,1...((n/2)-1)
+//   Fourier Frequency Order: 0,1...((n/2)-1),-n/2...-1
+
+void
+Fourier::shuffleNaturalToFourierOrder (double* pdVector, const int n)
+{
+  double* pdTemp = new double [n];
+  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 - 1; i++)
+      pdTemp[i + 1] = pdVector[i + iHalfN + 1];
+    for (i = 0; i < iHalfN; i++)
+      pdTemp[i + iHalfN] = pdVector[i];
+  }
+  
+  for (i = 0; i < n; i++)
+    pdVector[i] = pdTemp[i];
+  delete pdTemp;
+}
+
+void
+Fourier::shuffleNaturalToFourierOrder (std::complex<double>* pdVector, const int n)
+{
+  std::complex<double>* pdTemp = new std::complex<double> [n];
+  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 - 1; i++)
+      pdTemp[i + 1] = pdVector[i + iHalfN + 1];
+    for (i = 0; i < iHalfN; i++)
+      pdTemp[i + iHalfN] = pdVector[i];
+  }
+  
+  for (i = 0; i < n; i++)
+    pdVector[i] = pdTemp[i];
+  delete [] pdTemp;
+}
+
+
+void
+Fourier::shuffleNaturalToFourierOrder (float* pdVector, const int n)
+{
+  float* pdTemp = new float [n];
+  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 - 1; i++)
+      pdTemp[i + 1] = pdVector[i + iHalfN + 1];
+    for (i = 0; i < iHalfN; i++)
+      pdTemp[i + iHalfN] = pdVector[i];
+  }
+  
+  for (i = 0; i < n; i++)
+    pdVector[i] = pdTemp[i];
+  delete pdTemp;
+}
+
+
+
+void
+Fourier::shuffleFourierToNaturalOrder (double* pdVector, const int n)
+{
+  double* pdTemp = new double [n];
+  int i;
+  if (n % 2) { // Odd
+    int iHalfN = (n - 1) / 2;
+    
+    pdTemp[iHalfN] = pdVector[0];
+    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;
+}
+
+
+void
+Fourier::shuffleFourierToNaturalOrder (std::complex<double>* pdVector, const int n)
+{
+  std::complex<double>* pdTemp = new std::complex<double> [n];
+  int i;
+  if (n % 2) { // Odd
+    int iHalfN = (n - 1) / 2;
+    
+    pdTemp[iHalfN] = pdVector[0];
+    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;
+}
+
+
+
+
+void
+Fourier::shuffleFourierToNaturalOrder (float* pVector, const int n)
+{
+  float* pTemp = new float [n];
+  int i;
+  if (n % 2) { // Odd
+    int iHalfN = (n - 1) / 2;
+    
+    pTemp[iHalfN] = pVector[0];
+    for (i = 0; i < iHalfN; i++)
+      pTemp[i + 1 + iHalfN] = pVector[i + 1];
+    for (i = 0; i < iHalfN; i++)
+      pTemp[i] = pVector[i + iHalfN + 1];
+  } else {     // Even
+    int iHalfN = n / 2;
+    pTemp[iHalfN] = pVector[0];
+    for (i = 0; i < iHalfN; i++)
+      pTemp[i] = pVector[i + iHalfN];
+    for (i = 0; i < iHalfN - 1; i++)
+      pTemp[i + iHalfN + 1] = pVector[i+1];
+  }
+  
+  for (i = 0; i < n; i++)
+    pVector[i] = pTemp[i];
+  delete [] pTemp;
+}
+
+
index cc7e23489af837a9b99ef30f9f42369abce3b090..df0e51ec073981d312bdf265891a909d7125cc3a 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: imagefile.cpp,v 1.32 2001/01/02 10:23:46 kevin Exp $
+**  $Id: imagefile.cpp,v 1.33 2001/01/02 16:02:13 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 "ct.h"
 
-const int ImageFile::FORMAT_INVALID = -1;\r
-const int ImageFile::FORMAT_PGM = 0;\r
-const int ImageFile::FORMAT_PGMASCII = 1;\r
-#ifdef HAVE_PNG\r
-const int ImageFile::FORMAT_PNG = 2;\r
-const int ImageFile::FORMAT_PNG16 = 3;\r
-#endif\r
-\r
-const char* ImageFile::s_aszFormatName[] = \r
-{\r
-  {"pgm"},\r
-  {"pgmascii"},\r
-#ifdef HAVE_PNG\r
-  {"png"},\r
-  {"png16"},\r
-#endif\r
-};\r
-\r
-const char* ImageFile::s_aszFormatTitle[] = \r
-{\r
-  {"PGM"},\r
-  {"PGM ASCII"},\r
-  {"PNG"},\r
-  {"PNG 16-bit"},\r
-};\r
-\r
-const int ImageFile::s_iFormatCount = sizeof(s_aszFormatName) / sizeof(const char*);\r
-\r
-\r
+const int ImageFile::FORMAT_INVALID = -1;
+const int ImageFile::FORMAT_PGM = 0;
+const int ImageFile::FORMAT_PGMASCII = 1;
+#ifdef HAVE_PNG
+const int ImageFile::FORMAT_PNG = 2;
+const int ImageFile::FORMAT_PNG16 = 3;
+#endif
+
+const char* ImageFile::s_aszFormatName[] = 
+{
+  {"pgm"},
+  {"pgmascii"},
+#ifdef HAVE_PNG
+  {"png"},
+  {"png16"},
+#endif
+};
+
+const char* ImageFile::s_aszFormatTitle[] = 
+{
+  {"PGM"},
+  {"PGM ASCII"},
+  {"PNG"},
+  {"PNG 16-bit"},
+};
+
+const int ImageFile::s_iFormatCount = sizeof(s_aszFormatName) / sizeof(const char*);
 
-F32Image::F32Image (int nx, int ny, int dataType)\r
-: Array2dFile (nx, ny, sizeof(kfloat32), Array2dFile::PIXEL_FLOAT32, dataType)\r
-{\r
-}\r
-\r
-F32Image::F32Image (void)\r
-: Array2dFile()\r
-{\r
-  setPixelFormat (Array2dFile::PIXEL_FLOAT32);\r
-  setPixelSize (sizeof(kfloat32));\r
-  setDataType (Array2dFile::DATA_TYPE_REAL);\r
-}\r
-\r
-F64Image::F64Image (int nx, int ny, int dataType)\r
-: Array2dFile (nx, ny, sizeof(kfloat64), Array2dFile::PIXEL_FLOAT64, dataType)\r
-{\r
-}\r
-\r
-F64Image::F64Image (void)\r
-: Array2dFile ()\r
-{\r
-  setPixelFormat (PIXEL_FLOAT64);\r
-  setPixelSize (sizeof(kfloat64));\r
-  setDataType (Array2dFile::DATA_TYPE_REAL);\r
-}\r
+
+
+F32Image::F32Image (int nx, int ny, int dataType)
+: Array2dFile (nx, ny, sizeof(kfloat32), Array2dFile::PIXEL_FLOAT32, dataType)
+{
+}
+
+F32Image::F32Image (void)
+: Array2dFile()
+{
+  setPixelFormat (Array2dFile::PIXEL_FLOAT32);
+  setPixelSize (sizeof(kfloat32));
+  setDataType (Array2dFile::DATA_TYPE_REAL);
+}
+
+F64Image::F64Image (int nx, int ny, int dataType)
+: Array2dFile (nx, ny, sizeof(kfloat64), Array2dFile::PIXEL_FLOAT64, dataType)
+{
+}
+
+F64Image::F64Image (void)
+: Array2dFile ()
+{
+  setPixelFormat (PIXEL_FLOAT64);
+  setPixelSize (sizeof(kfloat64));
+  setDataType (Array2dFile::DATA_TYPE_REAL);
+}
 
 void 
 ImageFile::filterResponse (const char* const domainName, double bw, const char* const filterName, double filt_param, double dInputScale, double dOutputScale)
-{\r
-  ImageFileArray v = getArray();\r
-  SignalFilter filter (filterName, domainName, bw, filt_param);\r
-  \r
-  int iXCenter, iYCenter;\r
-  if (isEven (m_nx))\r
-    iXCenter = m_nx / 2;\r
-  else\r
-    iXCenter = (m_nx - 1) / 2;\r
-  if (isEven (m_ny))\r
-    iYCenter = m_ny / 2;\r
-  else\r
-    iYCenter = (m_ny - 1) / 2;\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++)\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      long lD2 = ((ix - iXCenter) * (ix - iXCenter)) + ((iy - iYCenter) * (iy - iYCenter));\r
-      double r = ::sqrt (static_cast<double>(lD2)) * dInputScale;\r
-      v[ix][iy] = filter.response (r) * dOutputScale;\r
-    }\r
+{
+  ImageFileArray v = getArray();
+  SignalFilter filter (filterName, domainName, bw, filt_param);
+  
+  int iXCenter, iYCenter;
+  if (isEven (m_nx))
+    iXCenter = m_nx / 2;
+  else
+    iXCenter = (m_nx - 1) / 2;
+  if (isEven (m_ny))
+    iYCenter = m_ny / 2;
+  else
+    iYCenter = (m_ny - 1) / 2;
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++)
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      long lD2 = ((ix - iXCenter) * (ix - iXCenter)) + ((iy - iYCenter) * (iy - iYCenter));
+      double r = ::sqrt (static_cast<double>(lD2)) * dInputScale;
+      v[ix][iy] = filter.response (r) * dOutputScale;
+    }
 }
 
 int
@@ -250,58 +250,58 @@ ImageFile::printStatistics (std::ostream& os) const
 {
   double min, max, mean, mode, median, stddev;
   
-  statistics (min, max, mean, mode, median, stddev);\r
-  if (isComplex())\r
-    os << "Real Component Statistics" << std::endl;\r
+  statistics (min, max, mean, mode, median, stddev);
+  if (isComplex())
+    os << "Real Component Statistics" << std::endl;
   
   os << "   min: " << min << std::endl;
   os << "   max: " << max << std::endl;
   os << "  mean: " << mean << std::endl;
   os << "  mode: " << mode << std::endl;
   os << "median: " << median << std::endl;
-  os << "stddev: " << stddev << std::endl;\r
-  \r
-  if (isComplex()) {\r
-    statistics (getImaginaryArray(), min, max, mean, mode, median, stddev);\r
+  os << "stddev: " << stddev << std::endl;
+  
+  if (isComplex()) {
+    statistics (getImaginaryArray(), min, max, mean, mode, median, stddev);
     os << std::endl << "Imaginary Component Statistics" << std::endl;
-    os << "   min: " << min << std::endl;\r
-    os << "   max: " << max << std::endl;\r
-    os << "  mean: " << mean << std::endl;\r
-    os << "  mode: " << mode << std::endl;\r
-    os << "median: " << median << std::endl;\r
-    os << "stddev: " << stddev << std::endl;\r
-  }\r
+    os << "   min: " << min << std::endl;
+    os << "   max: " << max << std::endl;
+    os << "  mean: " << mean << std::endl;
+    os << "  mode: " << mode << std::endl;
+    os << "median: " << median << std::endl;
+    os << "stddev: " << stddev << std::endl;
+  }
 }
 
 
 void
 ImageFile::statistics (double& min, double& max, double& mean, double& mode, double& median, double& stddev) const
-{\r
-  ImageFileArrayConst v = getArray();\r
-  statistics (v, min, max, mean, mode, median, stddev);\r
+{
+  ImageFileArrayConst v = getArray();
+  statistics (v, min, max, mean, mode, median, stddev);
 }
 
 
-void\r
-ImageFile::statistics (ImageFileArrayConst v, double& min, double& max, double& mean, double& mode, double& median, double& stddev) const\r
-{\r
-  int nx = m_nx;\r
-  int ny = m_ny;\r
-  \r
-  if (v == NULL || nx == 0 || ny == 0)\r
-    return;\r
-  \r
-  std::vector<double> vecImage;\r
-  int iVec = 0;\r
-  vecImage.resize (nx * ny);\r
-  for (int ix = 0; ix < nx; ix++) {\r
-    for (int iy = 0; iy < ny; iy++)\r
-      vecImage[iVec++] = v[ix][iy];\r
-  }\r
-  \r
-  vectorNumericStatistics (vecImage, nx * ny, min, max, mean, mode, median, stddev);\r
-}\r
-\r
+void
+ImageFile::statistics (ImageFileArrayConst v, double& min, double& max, double& mean, double& mode, double& median, double& stddev) const
+{
+  int nx = m_nx;
+  int ny = m_ny;
+  
+  if (v == NULL || nx == 0 || ny == 0)
+    return;
+  
+  std::vector<double> vecImage;
+  int iVec = 0;
+  vecImage.resize (nx * ny);
+  for (int ix = 0; ix < nx; ix++) {
+    for (int iy = 0; iy < ny; iy++)
+      vecImage[iVec++] = v[ix][iy];
+  }
+  
+  vectorNumericStatistics (vecImage, nx * ny, min, max, mean, mode, median, stddev);
+}
+
 void
 ImageFile::getMinMax (double& min, double& max) const
 {
@@ -323,796 +323,796 @@ ImageFile::getMinMax (double& min, double& max) const
     }
   }
 }
-\r
-bool\r
-ImageFile::convertRealToComplex ()\r
-{\r
-  if (dataType() != Array2dFile::DATA_TYPE_REAL)\r
-    return false;\r
-  \r
-  if (! reallocRealToComplex())\r
-    return false;\r
-  \r
-  ImageFileArray vImag = getImaginaryArray();\r
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    ImageFileColumn vCol = vImag[ix];\r
-    for (unsigned int iy = 0; iy < m_ny; iy++)\r
-      *vCol++ = 0;\r
-  }\r
-  \r
-  return true;\r
-}\r
-\r
-bool\r
-ImageFile::convertComplexToReal ()\r
-{\r
-  if (dataType() != Array2dFile::DATA_TYPE_COMPLEX)\r
-    return false;\r
-  \r
-  ImageFileArray vReal = getArray();\r
-  ImageFileArray vImag = getImaginaryArray();\r
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    ImageFileColumn vRealCol = vReal[ix];\r
-    ImageFileColumn vImagCol = vImag[ix];\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      CTSimComplex c (*vRealCol, *vImagCol);\r
-      *vRealCol++ = std::abs (c);\r
-      vImagCol++;\r
-    }\r
-  }\r
-  \r
-  return reallocComplexToReal();\r
-}\r
-\r
-bool\r
-ImageFile::subtractImages (const ImageFile& rRHS, ImageFile& result) const\r
-{\r
-  if (m_nx != rRHS.nx() || m_ny != rRHS.ny() || m_nx != result.nx() || m_ny != result.ny()) {\r
-    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::subtractImage]");\r
-    return false;\r
-  }\r
-  \r
-  if (isComplex() || rRHS.isComplex() && ! result.isComplex())\r
-    result.convertRealToComplex();\r
-  \r
-  ImageFileArrayConst vLHS = getArray();\r
-  ImageFileArrayConst vLHSImag = getImaginaryArray();\r
-  ImageFileArrayConst vRHS = rRHS.getArray();\r
-  ImageFileArrayConst vRHSImag = rRHS.getImaginaryArray();\r
-  ImageFileArray vResult = result.getArray();\r
-  ImageFileArray vResultImag = result.getImaginaryArray();\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      vResult[ix][iy] = vLHS[ix][iy] - vRHS[ix][iy];\r
-      if (result.isComplex()) {\r
-        vResultImag[ix][iy] = 0;\r
-        if (isComplex())\r
-          vResultImag[ix][iy] += vLHSImag[ix][iy];\r
-        if (rRHS.isComplex())\r
-          vResultImag[ix][iy] -= vRHSImag[ix][iy];\r
-      }\r
-    }\r
-  }\r
-  \r
-  return true;\r
-}\r
 
-bool\r
-ImageFile::addImages (const ImageFile& rRHS, ImageFile& result) const\r
-{\r
-  if (m_nx != rRHS.nx() || m_ny != rRHS.ny() || m_nx != result.nx() || m_ny != result.ny()) {\r
-    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::subtractImage]");\r
-    return false;\r
-  }\r
-  \r
-  if (isComplex() || rRHS.isComplex() && ! result.isComplex())\r
-    result.convertRealToComplex();\r
-  \r
-  ImageFileArrayConst vLHS = getArray();\r
-  ImageFileArrayConst vLHSImag = getImaginaryArray();\r
-  ImageFileArrayConst vRHS = rRHS.getArray();\r
-  ImageFileArrayConst vRHSImag = rRHS.getImaginaryArray();\r
-  ImageFileArray vResult = result.getArray();\r
-  ImageFileArray vResultImag = result.getImaginaryArray();\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      vResult[ix][iy] = vLHS[ix][iy] + vRHS[ix][iy];\r
-      if (result.isComplex()) {\r
-        vResultImag[ix][iy] = 0;\r
-        if (isComplex())\r
-          vResultImag[ix][iy] += vLHSImag[ix][iy];\r
-        if (rRHS.isComplex())\r
-          vResultImag[ix][iy] += vRHSImag[ix][iy];\r
-      }\r
-    }\r
-  }\r
-  \r
-  return true;\r
-}\r
-\r
-bool\r
-ImageFile::multiplyImages (const ImageFile& rRHS, ImageFile& result) const\r
-{\r
-  if (m_nx != rRHS.nx() || m_ny != rRHS.ny() || m_nx != result.nx() || m_ny != result.ny()) {\r
-    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::subtractImage]");\r
-    return false;\r
-  }\r
-  \r
-  if (isComplex() || rRHS.isComplex() && ! result.isComplex())\r
-    result.convertRealToComplex();\r
-  \r
-  ImageFileArrayConst vLHS = getArray();\r
-  ImageFileArrayConst vLHSImag = getImaginaryArray();\r
-  ImageFileArrayConst vRHS = rRHS.getArray();\r
-  ImageFileArrayConst vRHSImag = rRHS.getImaginaryArray();\r
-  ImageFileArray vResult = result.getArray();\r
-  ImageFileArray vResultImag = result.getImaginaryArray();\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      if (result.isComplex()) {\r
-        double dImag = 0;\r
-        if (isComplex())\r
-          dImag = vLHSImag[ix][iy];\r
-        std::complex<double> cLHS (vLHS[ix][iy], dImag);\r
-        dImag = 0;\r
-        if (rRHS.isComplex())\r
-          dImag = vRHSImag[ix][iy];\r
-        std::complex<double> cRHS (vRHS[ix][iy], dImag);\r
-        std::complex<double> cResult = cLHS * cRHS;\r
-        vResult[ix][iy] = cResult.real();\r
-        vResultImag[ix][iy] = cResult.imag();\r
-      } else\r
-        vResult[ix][iy] = vLHS[ix][iy] * vRHS[ix][iy];\r
-    }\r
-  }\r
-  \r
-  \r
-  return true;\r
-}\r
-\r
-bool\r
-ImageFile::divideImages (const ImageFile& rRHS, ImageFile& result) const\r
-{\r
-  if (m_nx != rRHS.nx() || m_ny != rRHS.ny() || m_nx != result.nx() || m_ny != result.ny()) {\r
-    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::subtractImage]");\r
-    return false;\r
-  }\r
-  \r
-  if (isComplex() || rRHS.isComplex() && ! result.isComplex())\r
-    result.convertRealToComplex();\r
-  \r
-  ImageFileArrayConst vLHS = getArray();\r
-  ImageFileArrayConst vLHSImag = getImaginaryArray();\r
-  ImageFileArrayConst vRHS = rRHS.getArray();\r
-  ImageFileArrayConst vRHSImag = rRHS.getImaginaryArray();\r
-  ImageFileArray vResult = result.getArray();\r
-  ImageFileArray vResultImag = result.getImaginaryArray();\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      if (result.isComplex()) {\r
-        double dImag = 0;\r
-        if (isComplex())\r
-          dImag = vLHSImag[ix][iy];\r
-        std::complex<double> cLHS (vLHS[ix][iy], dImag);\r
-        dImag = 0;\r
-        if (rRHS.isComplex())\r
-          dImag = vRHSImag[ix][iy];\r
-        std::complex<double> cRHS (vRHS[ix][iy], dImag);\r
-        std::complex<double> cResult = cLHS / cRHS;\r
-        vResult[ix][iy] = cResult.real();\r
-        vResultImag[ix][iy] = cResult.imag();\r
-      } else {\r
-        if (vRHS != 0)\r
-          vResult[ix][iy] = vLHS[ix][iy] / vRHS[ix][iy];\r
-        else\r
-          vResult[ix][iy] = 0;\r
-      }\r
-    }\r
-  }\r
-  \r
-  return true;\r
-}\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
-  if (isComplex() && ! result.isComplex())\r
-    result.convertRealToComplex();\r
-  \r
-  ImageFileArrayConst vLHS = getArray();\r
-  ImageFileArray vResult = result.getArray();\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    ImageFileColumnConst in = vLHS[ix];\r
-    ImageFileColumn out = vResult[ix];\r
-    for (unsigned 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
-  if (isComplex() && ! result.isComplex())\r
-    result.convertRealToComplex();\r
-  \r
-  bool bComplexOutput = result.isComplex();\r
-  ImageFileArrayConst vLHS = getArray();\r
-  if (! bComplexOutput)   // check if should convert to complex output\r
-    for (unsigned int ix = 0; ix < m_nx; ix++)\r
-      for (unsigned int iy = 0; iy < m_ny; iy++)\r
-        if (! bComplexOutput && vLHS[ix][iy] < 0) {\r
-          result.convertRealToComplex();\r
-          bComplexOutput = true;\r
-          break;\r
-        }\r
-        \r
-        ImageFileArrayConst vLHSImag = getImaginaryArray();\r
-        ImageFileArray vResult = result.getArray();\r
-        ImageFileArray vResultImag = result.getImaginaryArray();\r
-        \r
-        for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-          for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-            if (result.isComplex()) {\r
-              double dImag = 0;\r
-              if (isComplex())\r
-                dImag = vLHSImag[ix][iy];\r
-              std::complex<double> cLHS (vLHS[ix][iy], dImag);\r
-              std::complex<double> cResult = std::sqrt(cLHS);\r
-              vResult[ix][iy] = cResult.real();\r
-              vResultImag[ix][iy] = cResult.imag();\r
-            } else\r
-              vResult[ix][iy] = ::sqrt (vLHS[ix][iy]);\r
-          }\r
-        }\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
-  if (isComplex() && ! result.isComplex())\r
-    result.convertRealToComplex();\r
-  \r
-  ImageFileArrayConst vLHS = getArray();\r
-  ImageFileArrayConst vLHSImag = getImaginaryArray();\r
-  ImageFileArray vResult = result.getArray();\r
-  ImageFileArray vResultImag = result.getImaginaryArray();\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      if (result.isComplex()) {\r
-        double dImag = 0;\r
-        if (isComplex())\r
-          dImag = vLHSImag[ix][iy];\r
-        std::complex<double> cLHS (vLHS[ix][iy], dImag);\r
-        std::complex<double> cResult = std::log (cLHS);\r
-        vResult[ix][iy] = cResult.real();\r
-        vResultImag[ix][iy] = cResult.imag();\r
-      } else\r
-        vResult[ix][iy] = ::log (vLHS[ix][iy]);\r
-    }\r
-  }\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
-  if (isComplex() && ! result.isComplex())\r
-    result.convertRealToComplex();\r
-  \r
-  ImageFileArrayConst vLHS = getArray();\r
-  ImageFileArrayConst vLHSImag = getImaginaryArray();\r
-  ImageFileArray vResult = result.getArray();\r
-  ImageFileArray vResultImag = result.getImaginaryArray();\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      if (result.isComplex()) {\r
-        double dImag = 0;\r
-        if (isComplex())\r
-          dImag = vLHSImag[ix][iy];\r
-        std::complex<double> cLHS (vLHS[ix][iy], dImag);\r
-        std::complex<double> cResult = std::exp (cLHS);\r
-        vResult[ix][iy] = cResult.real();\r
-        vResultImag[ix][iy] = cResult.imag();\r
-      } else\r
-        vResult[ix][iy] = ::exp (vLHS[ix][iy]);\r
-    }\r
-  }\r
-  \r
-  \r
-  return true;\r
-}\r
-\r
-bool\r
-ImageFile::scaleImage (ImageFile& result) const\r
-{\r
-  unsigned int nx = m_nx;\r
-  unsigned int ny = m_ny;\r
-  unsigned int newNX = result.nx();\r
-  unsigned int newNY = result.ny();\r
-  \r
-  double dXScale = static_cast<double>(newNX) / static_cast<double>(nx);\r
-  double dYScale = static_cast<double>(newNY) / static_cast<double>(ny);\r
-  \r
-  if (isComplex() && ! result.isComplex())\r
-    result.convertRealToComplex();\r
-  \r
-  ImageFileArrayConst vReal = getArray();\r
-  ImageFileArrayConst vImag = getImaginaryArray();\r
-  ImageFileArray vResult = result.getArray();\r
-  ImageFileArray vResultImag = result.getImaginaryArray();\r
-  \r
-  for (unsigned int ix = 0; ix < newNX; ix++) {\r
-    for (unsigned int iy = 0; iy < newNY; iy++) {\r
-      double dXPos = ix / dXScale;\r
-      double dYPos = iy / dYScale;\r
-      unsigned int scaleNX = static_cast<unsigned int> (dXPos);\r
-      unsigned int scaleNY = static_cast<unsigned int> (dYPos);\r
-      double dXFrac = dXPos - scaleNX;\r
-      double dYFrac = dYPos - scaleNY;\r
-      if (scaleNX >= nx - 1 || scaleNY >= ny - 1) {\r
-        vResult[ix][iy] = vReal[scaleNX][scaleNY];\r
-        if (result.isComplex()) {\r
-          if (isComplex())\r
-            vResultImag[ix][iy] = vImag[scaleNX][scaleNY];\r
-          else\r
-            vResultImag[ix][iy] = 0;\r
-        }\r
-      } else {\r
-        vResult[ix][iy] = vReal[scaleNX][scaleNY] + \r
-          dXFrac * (vReal[scaleNX+1][scaleNY] - vReal[scaleNX][scaleNY]) + \r
-          dYFrac * (vReal[scaleNX][scaleNY+1] - vReal[scaleNX][scaleNY]);\r
-        if (result.isComplex()) {\r
-          if (isComplex())\r
-            vResultImag[ix][iy] = vImag[scaleNX][scaleNY] + \r
-            dXFrac * (vImag[scaleNX+1][scaleNY] - vImag[scaleNX][scaleNY]) + \r
-            dYFrac * (vImag[scaleNX][scaleNY+1] - vImag[scaleNX][scaleNY]);\r
-          else\r
-            vResultImag[ix][iy] = 0;\r
-        }\r
-      }\r
-    }\r
-  }\r
-  \r
-  return true;\r
-}\r
-\r
-#ifdef HAVE_FFTW\r
-bool\r
-ImageFile::fft (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
-  if (result.dataType() == Array2dFile::DATA_TYPE_REAL) {\r
-    if (! result.convertRealToComplex ())\r
-      return false;\r
-  }\r
-  \r
-  fftw_complex* in = new fftw_complex [m_nx * m_ny];\r
-  \r
-  ImageFileArrayConst vReal = getArray();\r
-  ImageFileArrayConst vImag = getImaginaryArray();\r
-  \r
-  unsigned int ix, iy;\r
-  unsigned int iArray = 0;\r
-  for (ix = 0; ix < m_nx; ix++)\r
-    for (iy = 0; iy < m_ny; iy++) {\r
-      in[iArray].re = vReal[ix][iy];\r
-      if (isComplex())\r
-        in[iArray].im = vImag[ix][iy];\r
-      else\r
-        in[iArray].im = 0;\r
-      iArray++;\r
-    }\r
-    \r
-    fftwnd_plan plan = fftw2d_create_plan (m_nx, m_ny, FFTW_FORWARD, FFTW_IN_PLACE);\r
-    \r
-    fftwnd_one (plan, in, NULL);\r
-    \r
-    ImageFileArray vRealResult = result.getArray();\r
-    ImageFileArray vImagResult = result.getImaginaryArray();\r
-    iArray = 0;\r
-    unsigned int iScale = m_nx * m_ny;\r
-    for (ix = 0; ix < m_nx; ix++)\r
-      for (iy = 0; iy < m_ny; iy++) {\r
-        vRealResult[ix][iy] = in[iArray].re / iScale;\r
-        vImagResult[ix][iy] = in[iArray].im / iScale;\r
-        iArray++;\r
-      }\r
-      \r
-      fftwnd_destroy_plan (plan);\r
-      delete in;\r
-      \r
-      \r
-      Fourier::shuffleFourierToNaturalOrder (result);\r
-      \r
-      return true;\r
-}\r
-\r
-\r
-bool\r
-ImageFile::ifft (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
-  if (result.dataType() == Array2dFile::DATA_TYPE_REAL) {\r
-    if (! result.convertRealToComplex ())\r
-      return false;\r
-  }\r
-  \r
-  ImageFileArrayConst vReal = getArray();\r
-  ImageFileArrayConst vImag = getImaginaryArray();\r
-  ImageFileArray vRealResult = result.getArray();\r
-  ImageFileArray vImagResult = result.getImaginaryArray();\r
-  unsigned int ix, iy;\r
-  for (ix = 0; ix < m_nx; ix++)\r
-    for (iy = 0; iy < m_ny; iy++) {\r
-      vRealResult[ix][iy] = vReal[ix][iy];\r
-      if (isComplex()) \r
-        vImagResult[ix][iy] = vImag[ix][iy];\r
-      else\r
-        vImagResult[ix][iy] = 0;\r
-    }\r
-    \r
-    Fourier::shuffleNaturalToFourierOrder (result);\r
-    \r
-    fftw_complex* in = new fftw_complex [m_nx * m_ny];\r
-    \r
-    unsigned int iArray = 0;\r
-    for (ix = 0; ix < m_nx; ix++)\r
-      for (iy = 0; iy < m_ny; iy++) {\r
-        in[iArray].re = vRealResult[ix][iy];\r
-        in[iArray].im = vImagResult[ix][iy];\r
-        iArray++;\r
-      }\r
-      \r
-      fftwnd_plan plan = fftw2d_create_plan (m_nx, m_ny, FFTW_BACKWARD, FFTW_IN_PLACE);\r
-      \r
-      fftwnd_one (plan, in, NULL);\r
-      \r
-      iArray = 0;\r
-      for (ix = 0; ix < m_nx; ix++)\r
-        for (iy = 0; iy < m_ny; iy++) {\r
-          vRealResult[ix][iy] = in[iArray].re;\r
-          vImagResult[ix][iy] = in[iArray].im;\r
-          iArray++;\r
-        }\r
-        \r
-        fftwnd_destroy_plan (plan);\r
-        \r
-        delete in;\r
-        \r
-        return true;\r
-}\r
-#endif // HAVE_FFTW\r
-\r
-\r
-\r
-bool\r
-ImageFile::fourier (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
-  if (! result.isComplex())\r
-    if (! result.convertRealToComplex ())\r
-      return false;\r
-    \r
-    ImageFileArrayConst vLHS = getArray();\r
-    ImageFileArrayConst vLHSImag = getImaginaryArray();\r
-    ImageFileArray vRealResult = result.getArray();\r
-    ImageFileArray vImagResult = result.getImaginaryArray();\r
-    \r
-    unsigned int ix, iy;\r
-    \r
-    // alloc output matrix\r
-    CTSimComplex** complexOut = new CTSimComplex* [m_nx];\r
-    for (ix = 0; ix < m_nx; ix++)\r
-      complexOut[ix] = new CTSimComplex [m_ny];\r
-    \r
-    // fourier each x column\r
-    CTSimComplex* pY = new CTSimComplex [m_ny];\r
-    for (ix = 0; ix < m_nx; ix++) {\r
-      for (iy = 0; iy < m_ny; iy++) {\r
-        double dImag = 0;\r
-        if (isComplex())\r
-          dImag = vLHSImag[ix][iy];\r
-        pY[iy] = std::complex<double>(vLHS[ix][iy], dImag);\r
-      } \r
-      ProcessSignal::finiteFourierTransform (pY, complexOut[ix], m_ny,  ProcessSignal::FORWARD);\r
-    }\r
-    delete [] pY;\r
-    \r
-    // fourier each y row\r
-    CTSimComplex* pX = new CTSimComplex [m_nx];\r
-    CTSimComplex* complexOutRow = new CTSimComplex [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, complexOutRow, m_nx, ProcessSignal::FORWARD);\r
-      for (ix = 0; ix < m_nx; ix++)\r
-        complexOut[ix][iy] = complexOutRow[ix];\r
-    }\r
-    delete [] pX;\r
-    delete [] complexOutRow;\r
-    \r
-    for (ix = 0; ix < m_nx; ix++)\r
-      for (iy = 0; iy < m_ny; iy++) {\r
-        vRealResult[ix][iy] = complexOut[ix][iy].real();\r
-        vImagResult[ix][iy] = complexOut[ix][iy].imag();\r
-      }\r
-      \r
-      Fourier::shuffleFourierToNaturalOrder (result);\r
-      \r
-      // delete complexOut matrix\r
-      for (ix = 0; ix < m_nx; ix++)\r
-        delete [] complexOut[ix];\r
-      delete [] complexOut;\r
-      \r
-      return true;\r
-}\r
-\r
-bool\r
-ImageFile::inverseFourier (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
-  if (result.dataType() == Array2dFile::DATA_TYPE_REAL) {\r
-    if (! result.convertRealToComplex ())\r
-      return false;\r
-  }\r
-  \r
-  ImageFileArrayConst vLHSReal = getArray();\r
-  ImageFileArrayConst vLHSImag = getImaginaryArray();\r
-  ImageFileArray vRealResult = result.getArray();\r
-  ImageFileArray vImagResult = result.getImaginaryArray();\r
-  \r
-  unsigned int ix, iy;\r
-  // alloc 2d complex output matrix\r
-  CTSimComplex** complexOut = new CTSimComplex* [m_nx];\r
-  for (ix = 0; ix < m_nx; ix++)\r
-    complexOut[ix] = new CTSimComplex [m_ny];\r
-  \r
-  // put input image into result\r
-  for (ix = 0; ix < m_nx; ix++)\r
-    for (iy = 0; iy < m_ny; iy++) {\r
-      vRealResult[ix][iy] = vLHSReal[ix][iy];\r
-      if (isComplex())\r
-        vImagResult[ix][iy] = vLHSImag[ix][iy];\r
-      else\r
-        vImagResult[ix][iy] = 0;\r
-    }\r
-    \r
-    Fourier::shuffleNaturalToFourierOrder (result);\r
-    \r
-    // ifourier each x column\r
-    CTSimComplex* pCol = new CTSimComplex [m_ny];\r
-    for (ix = 0; ix < m_nx; ix++) {\r
-      for (iy = 0; iy < m_ny; iy++) {\r
-        pCol[iy] = std::complex<double> (vRealResult[ix][iy], vImagResult[ix][iy]);\r
-      }\r
-      ProcessSignal::finiteFourierTransform (pCol, complexOut[ix], m_ny,  ProcessSignal::BACKWARD);\r
-    }\r
-    delete [] pCol;\r
-    \r
-    // ifourier each y row\r
-    CTSimComplex* complexInRow = new CTSimComplex [m_nx];\r
-    CTSimComplex* complexOutRow = new CTSimComplex [m_nx];\r
-    for (iy = 0; iy < m_ny; iy++) {\r
-      for (ix = 0; ix < m_nx; ix++)\r
-        complexInRow[ix] = complexOut[ix][iy];\r
-      ProcessSignal::finiteFourierTransform (complexInRow, complexOutRow, m_nx, ProcessSignal::BACKWARD);\r
-      for (ix = 0; ix < m_nx; ix++)\r
-        complexOut[ix][iy] = complexOutRow[ix];\r
-    }\r
-    delete [] complexInRow;\r
-    delete [] complexOutRow;\r
-    \r
-    for (ix = 0; ix < m_nx; ix++)\r
-      for (iy = 0; iy < m_ny; iy++) {\r
-        vRealResult[ix][iy] = complexOut[ix][iy].real();\r
-        vImagResult[ix][iy] = complexOut[ix][iy].imag();\r
-      }\r
-      \r
-      // delete complexOut matrix\r
-      for (ix = 0; ix < m_nx; ix++)\r
-        delete [] complexOut[ix];\r
-      delete [] complexOut;\r
-      \r
-      return true;\r
-}\r
-\r
-\r
-bool\r
-ImageFile::magnitude (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
-  ImageFileArray vReal = getArray();\r
-  ImageFileArray vImag = getImaginaryArray();\r
-  ImageFileArray vRealResult = result.getArray();\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++)\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      if (isComplex()) \r
-        vRealResult[ix][iy] = ::sqrt (vReal[ix][iy] * vReal[ix][iy] + vImag[ix][iy] * vImag[ix][iy]);\r
-      else\r
-        vRealResult[ix][iy] = vReal[ix][iy];\r
-    }\r
-    \r
-    if (result.isComplex())\r
-      result.convertComplexToReal();\r
-    \r
-    return true;\r
-}\r
-\r
-bool\r
-ImageFile::phase (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
-  ImageFileArray vReal = getArray();\r
-  ImageFileArray vImag = getImaginaryArray();\r
-  ImageFileArray vRealResult = result.getArray();\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++)\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      if (isComplex())\r
-        vRealResult[ix][iy] = ::atan2 (vImag[ix][iy], vReal[ix][iy]);\r
-      else\r
-        vRealResult[ix][iy] = 0;\r
-    }\r
-    \r
-    if (result.isComplex())\r
-      result.convertComplexToReal();\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
-  if (isComplex() && ! result.isComplex())\r
-    result.convertRealToComplex();\r
-  \r
-  ImageFileArrayConst vLHS = getArray();\r
-  ImageFileArrayConst vLHSImag = getImaginaryArray();\r
-  ImageFileArray vResult = result.getArray();\r
-  ImageFileArray vResultImag = result.getImaginaryArray();\r
-  \r
-  for (unsigned int ix = 0; ix < m_nx; ix++) {\r
-    for (unsigned int iy = 0; iy < m_ny; iy++) {\r
-      if (result.isComplex()) {\r
-        double dImag = 0;\r
-        if (isComplex())\r
-          dImag = vLHSImag[ix][iy];\r
-        std::complex<double> cLHS (vLHS[ix][iy], dImag);\r
-        std::complex<double> cResult = cLHS * cLHS;\r
-        vResult[ix][iy] = cResult.real();\r
-        vResultImag[ix][iy] = cResult.imag();\r
-      } else\r
-        vResult[ix][iy] = vLHS[ix][iy] * vLHS[ix][iy];\r
-    }\r
-  }\r
-  \r
-  \r
-  return true;\r
-}\r
-\r
-int\r
-ImageFile::convertFormatNameToID (const char* const formatName)\r
-{\r
-  int formatID = FORMAT_INVALID;\r
-  \r
-  for (int i = 0; i < s_iFormatCount; i++)\r
-    if (strcasecmp (formatName, s_aszFormatName[i]) == 0) {\r
-      formatID = i;\r
-      break;\r
-    }\r
-    \r
-    return (formatID);\r
-}\r
-\r
-const char*\r
-ImageFile::convertFormatIDToName (int formatID)\r
-{\r
-  static const char *formatName = "";\r
-  \r
-  if (formatID >= 0 && formatID < s_iFormatCount)\r
-    return (s_aszFormatName[formatID]);\r
-  \r
-  return (formatName);\r
-}\r
-\r
-const char*\r
-ImageFile::convertFormatIDToTitle (const int formatID)\r
-{\r
-  static const char *formatTitle = "";\r
-  \r
-  if (formatID >= 0 && formatID < s_iFormatCount)\r
-    return (s_aszFormatTitle[formatID]);\r
-  \r
-  return (formatTitle);\r
-}\r
-\r
-bool\r
-ImageFile::exportImage (const char* const pszFormat, const char* const pszFilename, int nxcell, int nycell, double densmin, double densmax)\r
-{\r
-  int iFormatID = convertFormatNameToID (pszFormat);\r
-  if (iFormatID == FORMAT_INVALID) {\r
-    sys_error (ERR_SEVERE, "Invalid format %s [ImageFile::exportImage]", pszFormat);\r
-    return false;\r
-  }\r
-  \r
-  if (iFormatID == FORMAT_PGM)\r
-    return writeImagePGM (pszFilename, nxcell, nycell, densmin, densmax);\r
-  else if (iFormatID == FORMAT_PGMASCII)\r
-    return writeImagePGMASCII (pszFilename, nxcell, nycell, densmin, densmax);\r
-  else if (iFormatID == FORMAT_PNG)\r
-    return writeImagePNG (pszFilename, 8, nxcell, nycell, densmin, densmax);\r
-  else if (iFormatID == FORMAT_PNG16)\r
-    return writeImagePNG (pszFilename, 16, nxcell, nycell, densmin, densmax);\r
-  \r
-  sys_error (ERR_SEVERE, "Invalid format %s [ImageFile::exportImage]", pszFormat);\r
-  return false;\r
-}\r
-\r
+bool
+ImageFile::convertRealToComplex ()
+{
+  if (dataType() != Array2dFile::DATA_TYPE_REAL)
+    return false;
+  
+  if (! reallocRealToComplex())
+    return false;
+  
+  ImageFileArray vImag = getImaginaryArray();
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    ImageFileColumn vCol = vImag[ix];
+    for (unsigned int iy = 0; iy < m_ny; iy++)
+      *vCol++ = 0;
+  }
+  
+  return true;
+}
+
+bool
+ImageFile::convertComplexToReal ()
+{
+  if (dataType() != Array2dFile::DATA_TYPE_COMPLEX)
+    return false;
+  
+  ImageFileArray vReal = getArray();
+  ImageFileArray vImag = getImaginaryArray();
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    ImageFileColumn vRealCol = vReal[ix];
+    ImageFileColumn vImagCol = vImag[ix];
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      CTSimComplex c (*vRealCol, *vImagCol);
+      *vRealCol++ = std::abs (c);
+      vImagCol++;
+    }
+  }
+  
+  return reallocComplexToReal();
+}
+
+bool
+ImageFile::subtractImages (const ImageFile& rRHS, ImageFile& result) const
+{
+  if (m_nx != rRHS.nx() || m_ny != rRHS.ny() || m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::subtractImage]");
+    return false;
+  }
+  
+  if (isComplex() || rRHS.isComplex() && ! result.isComplex())
+    result.convertRealToComplex();
+  
+  ImageFileArrayConst vLHS = getArray();
+  ImageFileArrayConst vLHSImag = getImaginaryArray();
+  ImageFileArrayConst vRHS = rRHS.getArray();
+  ImageFileArrayConst vRHSImag = rRHS.getImaginaryArray();
+  ImageFileArray vResult = result.getArray();
+  ImageFileArray vResultImag = result.getImaginaryArray();
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      vResult[ix][iy] = vLHS[ix][iy] - vRHS[ix][iy];
+      if (result.isComplex()) {
+        vResultImag[ix][iy] = 0;
+        if (isComplex())
+          vResultImag[ix][iy] += vLHSImag[ix][iy];
+        if (rRHS.isComplex())
+          vResultImag[ix][iy] -= vRHSImag[ix][iy];
+      }
+    }
+  }
+  
+  return true;
+}
+
+bool
+ImageFile::addImages (const ImageFile& rRHS, ImageFile& result) const
+{
+  if (m_nx != rRHS.nx() || m_ny != rRHS.ny() || m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::subtractImage]");
+    return false;
+  }
+  
+  if (isComplex() || rRHS.isComplex() && ! result.isComplex())
+    result.convertRealToComplex();
+  
+  ImageFileArrayConst vLHS = getArray();
+  ImageFileArrayConst vLHSImag = getImaginaryArray();
+  ImageFileArrayConst vRHS = rRHS.getArray();
+  ImageFileArrayConst vRHSImag = rRHS.getImaginaryArray();
+  ImageFileArray vResult = result.getArray();
+  ImageFileArray vResultImag = result.getImaginaryArray();
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      vResult[ix][iy] = vLHS[ix][iy] + vRHS[ix][iy];
+      if (result.isComplex()) {
+        vResultImag[ix][iy] = 0;
+        if (isComplex())
+          vResultImag[ix][iy] += vLHSImag[ix][iy];
+        if (rRHS.isComplex())
+          vResultImag[ix][iy] += vRHSImag[ix][iy];
+      }
+    }
+  }
+  
+  return true;
+}
+
+bool
+ImageFile::multiplyImages (const ImageFile& rRHS, ImageFile& result) const
+{
+  if (m_nx != rRHS.nx() || m_ny != rRHS.ny() || m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::subtractImage]");
+    return false;
+  }
+  
+  if (isComplex() || rRHS.isComplex() && ! result.isComplex())
+    result.convertRealToComplex();
+  
+  ImageFileArrayConst vLHS = getArray();
+  ImageFileArrayConst vLHSImag = getImaginaryArray();
+  ImageFileArrayConst vRHS = rRHS.getArray();
+  ImageFileArrayConst vRHSImag = rRHS.getImaginaryArray();
+  ImageFileArray vResult = result.getArray();
+  ImageFileArray vResultImag = result.getImaginaryArray();
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      if (result.isComplex()) {
+        double dImag = 0;
+        if (isComplex())
+          dImag = vLHSImag[ix][iy];
+        std::complex<double> cLHS (vLHS[ix][iy], dImag);
+        dImag = 0;
+        if (rRHS.isComplex())
+          dImag = vRHSImag[ix][iy];
+        std::complex<double> cRHS (vRHS[ix][iy], dImag);
+        std::complex<double> cResult = cLHS * cRHS;
+        vResult[ix][iy] = cResult.real();
+        vResultImag[ix][iy] = cResult.imag();
+      } else
+        vResult[ix][iy] = vLHS[ix][iy] * vRHS[ix][iy];
+    }
+  }
+  
+  
+  return true;
+}
+
+bool
+ImageFile::divideImages (const ImageFile& rRHS, ImageFile& result) const
+{
+  if (m_nx != rRHS.nx() || m_ny != rRHS.ny() || m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::subtractImage]");
+    return false;
+  }
+  
+  if (isComplex() || rRHS.isComplex() && ! result.isComplex())
+    result.convertRealToComplex();
+  
+  ImageFileArrayConst vLHS = getArray();
+  ImageFileArrayConst vLHSImag = getImaginaryArray();
+  ImageFileArrayConst vRHS = rRHS.getArray();
+  ImageFileArrayConst vRHSImag = rRHS.getImaginaryArray();
+  ImageFileArray vResult = result.getArray();
+  ImageFileArray vResultImag = result.getImaginaryArray();
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      if (result.isComplex()) {
+        double dImag = 0;
+        if (isComplex())
+          dImag = vLHSImag[ix][iy];
+        std::complex<double> cLHS (vLHS[ix][iy], dImag);
+        dImag = 0;
+        if (rRHS.isComplex())
+          dImag = vRHSImag[ix][iy];
+        std::complex<double> cRHS (vRHS[ix][iy], dImag);
+        std::complex<double> cResult = cLHS / cRHS;
+        vResult[ix][iy] = cResult.real();
+        vResultImag[ix][iy] = cResult.imag();
+      } else {
+        if (vRHS != 0)
+          vResult[ix][iy] = vLHS[ix][iy] / vRHS[ix][iy];
+        else
+          vResult[ix][iy] = 0;
+      }
+    }
+  }
+  
+  return true;
+}
+
+
+bool
+ImageFile::invertPixelValues (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  if (isComplex() && ! result.isComplex())
+    result.convertRealToComplex();
+  
+  ImageFileArrayConst vLHS = getArray();
+  ImageFileArray vResult = result.getArray();
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    ImageFileColumnConst in = vLHS[ix];
+    ImageFileColumn out = vResult[ix];
+    for (unsigned int iy = 0; iy < m_ny; iy++)
+      *out++ = - *in++;
+  }
+  
+  return true;
+}
+
+bool
+ImageFile::sqrt (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  if (isComplex() && ! result.isComplex())
+    result.convertRealToComplex();
+  
+  bool bComplexOutput = result.isComplex();
+  ImageFileArrayConst vLHS = getArray();
+  if (! bComplexOutput)   // check if should convert to complex output
+    for (unsigned int ix = 0; ix < m_nx; ix++)
+      for (unsigned int iy = 0; iy < m_ny; iy++)
+        if (! bComplexOutput && vLHS[ix][iy] < 0) {
+          result.convertRealToComplex();
+          bComplexOutput = true;
+          break;
+        }
+        
+        ImageFileArrayConst vLHSImag = getImaginaryArray();
+        ImageFileArray vResult = result.getArray();
+        ImageFileArray vResultImag = result.getImaginaryArray();
+        
+        for (unsigned int ix = 0; ix < m_nx; ix++) {
+          for (unsigned int iy = 0; iy < m_ny; iy++) {
+            if (result.isComplex()) {
+              double dImag = 0;
+              if (isComplex())
+                dImag = vLHSImag[ix][iy];
+              std::complex<double> cLHS (vLHS[ix][iy], dImag);
+              std::complex<double> cResult = std::sqrt(cLHS);
+              vResult[ix][iy] = cResult.real();
+              vResultImag[ix][iy] = cResult.imag();
+            } else
+              vResult[ix][iy] = ::sqrt (vLHS[ix][iy]);
+          }
+        }
+        
+        
+        return true;
+}
+
+bool
+ImageFile::log (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  if (isComplex() && ! result.isComplex())
+    result.convertRealToComplex();
+  
+  ImageFileArrayConst vLHS = getArray();
+  ImageFileArrayConst vLHSImag = getImaginaryArray();
+  ImageFileArray vResult = result.getArray();
+  ImageFileArray vResultImag = result.getImaginaryArray();
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      if (result.isComplex()) {
+        double dImag = 0;
+        if (isComplex())
+          dImag = vLHSImag[ix][iy];
+        std::complex<double> cLHS (vLHS[ix][iy], dImag);
+        std::complex<double> cResult = std::log (cLHS);
+        vResult[ix][iy] = cResult.real();
+        vResultImag[ix][iy] = cResult.imag();
+      } else
+        vResult[ix][iy] = ::log (vLHS[ix][iy]);
+    }
+  }
+  
+  
+  return true;
+}
+
+bool
+ImageFile::exp (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  if (isComplex() && ! result.isComplex())
+    result.convertRealToComplex();
+  
+  ImageFileArrayConst vLHS = getArray();
+  ImageFileArrayConst vLHSImag = getImaginaryArray();
+  ImageFileArray vResult = result.getArray();
+  ImageFileArray vResultImag = result.getImaginaryArray();
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      if (result.isComplex()) {
+        double dImag = 0;
+        if (isComplex())
+          dImag = vLHSImag[ix][iy];
+        std::complex<double> cLHS (vLHS[ix][iy], dImag);
+        std::complex<double> cResult = std::exp (cLHS);
+        vResult[ix][iy] = cResult.real();
+        vResultImag[ix][iy] = cResult.imag();
+      } else
+        vResult[ix][iy] = ::exp (vLHS[ix][iy]);
+    }
+  }
+  
+  
+  return true;
+}
+
+bool
+ImageFile::scaleImage (ImageFile& result) const
+{
+  unsigned int nx = m_nx;
+  unsigned int ny = m_ny;
+  unsigned int newNX = result.nx();
+  unsigned int newNY = result.ny();
+  
+  double dXScale = static_cast<double>(newNX) / static_cast<double>(nx);
+  double dYScale = static_cast<double>(newNY) / static_cast<double>(ny);
+  
+  if (isComplex() && ! result.isComplex())
+    result.convertRealToComplex();
+  
+  ImageFileArrayConst vReal = getArray();
+  ImageFileArrayConst vImag = getImaginaryArray();
+  ImageFileArray vResult = result.getArray();
+  ImageFileArray vResultImag = result.getImaginaryArray();
+  
+  for (unsigned int ix = 0; ix < newNX; ix++) {
+    for (unsigned int iy = 0; iy < newNY; iy++) {
+      double dXPos = ix / dXScale;
+      double dYPos = iy / dYScale;
+      unsigned int scaleNX = static_cast<unsigned int> (dXPos);
+      unsigned int scaleNY = static_cast<unsigned int> (dYPos);
+      double dXFrac = dXPos - scaleNX;
+      double dYFrac = dYPos - scaleNY;
+      if (scaleNX >= nx - 1 || scaleNY >= ny - 1) {
+        vResult[ix][iy] = vReal[scaleNX][scaleNY];
+        if (result.isComplex()) {
+          if (isComplex())
+            vResultImag[ix][iy] = vImag[scaleNX][scaleNY];
+          else
+            vResultImag[ix][iy] = 0;
+        }
+      } else {
+        vResult[ix][iy] = vReal[scaleNX][scaleNY] + 
+          dXFrac * (vReal[scaleNX+1][scaleNY] - vReal[scaleNX][scaleNY]) + 
+          dYFrac * (vReal[scaleNX][scaleNY+1] - vReal[scaleNX][scaleNY]);
+        if (result.isComplex()) {
+          if (isComplex())
+            vResultImag[ix][iy] = vImag[scaleNX][scaleNY] + 
+            dXFrac * (vImag[scaleNX+1][scaleNY] - vImag[scaleNX][scaleNY]) + 
+            dYFrac * (vImag[scaleNX][scaleNY+1] - vImag[scaleNX][scaleNY]);
+          else
+            vResultImag[ix][iy] = 0;
+        }
+      }
+    }
+  }
+  
+  return true;
+}
+
+#ifdef HAVE_FFTW
+bool
+ImageFile::fft (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  if (result.dataType() == Array2dFile::DATA_TYPE_REAL) {
+    if (! result.convertRealToComplex ())
+      return false;
+  }
+  
+  fftw_complex* in = new fftw_complex [m_nx * m_ny];
+  
+  ImageFileArrayConst vReal = getArray();
+  ImageFileArrayConst vImag = getImaginaryArray();
+  
+  unsigned int ix, iy;
+  unsigned int iArray = 0;
+  for (ix = 0; ix < m_nx; ix++)
+    for (iy = 0; iy < m_ny; iy++) {
+      in[iArray].re = vReal[ix][iy];
+      if (isComplex())
+        in[iArray].im = vImag[ix][iy];
+      else
+        in[iArray].im = 0;
+      iArray++;
+    }
+    
+    fftwnd_plan plan = fftw2d_create_plan (m_nx, m_ny, FFTW_FORWARD, FFTW_IN_PLACE);
+    
+    fftwnd_one (plan, in, NULL);
+    
+    ImageFileArray vRealResult = result.getArray();
+    ImageFileArray vImagResult = result.getImaginaryArray();
+    iArray = 0;
+    unsigned int iScale = m_nx * m_ny;
+    for (ix = 0; ix < m_nx; ix++)
+      for (iy = 0; iy < m_ny; iy++) {
+        vRealResult[ix][iy] = in[iArray].re / iScale;
+        vImagResult[ix][iy] = in[iArray].im / iScale;
+        iArray++;
+      }
+      
+      fftwnd_destroy_plan (plan);
+      delete in;
+      
+      
+      Fourier::shuffleFourierToNaturalOrder (result);
+      
+      return true;
+}
+
+
+bool
+ImageFile::ifft (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  if (result.dataType() == Array2dFile::DATA_TYPE_REAL) {
+    if (! result.convertRealToComplex ())
+      return false;
+  }
+  
+  ImageFileArrayConst vReal = getArray();
+  ImageFileArrayConst vImag = getImaginaryArray();
+  ImageFileArray vRealResult = result.getArray();
+  ImageFileArray vImagResult = result.getImaginaryArray();
+  unsigned int ix, iy;
+  for (ix = 0; ix < m_nx; ix++)
+    for (iy = 0; iy < m_ny; iy++) {
+      vRealResult[ix][iy] = vReal[ix][iy];
+      if (isComplex()) 
+        vImagResult[ix][iy] = vImag[ix][iy];
+      else
+        vImagResult[ix][iy] = 0;
+    }
+    
+    Fourier::shuffleNaturalToFourierOrder (result);
+    
+    fftw_complex* in = new fftw_complex [m_nx * m_ny];
+    
+    unsigned int iArray = 0;
+    for (ix = 0; ix < m_nx; ix++)
+      for (iy = 0; iy < m_ny; iy++) {
+        in[iArray].re = vRealResult[ix][iy];
+        in[iArray].im = vImagResult[ix][iy];
+        iArray++;
+      }
+      
+      fftwnd_plan plan = fftw2d_create_plan (m_nx, m_ny, FFTW_BACKWARD, FFTW_IN_PLACE);
+      
+      fftwnd_one (plan, in, NULL);
+      
+      iArray = 0;
+      for (ix = 0; ix < m_nx; ix++)
+        for (iy = 0; iy < m_ny; iy++) {
+          vRealResult[ix][iy] = in[iArray].re;
+          vImagResult[ix][iy] = in[iArray].im;
+          iArray++;
+        }
+        
+        fftwnd_destroy_plan (plan);
+        
+        delete in;
+        
+        return true;
+}
+#endif // HAVE_FFTW
+
+
+
+bool
+ImageFile::fourier (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  if (! result.isComplex())
+    if (! result.convertRealToComplex ())
+      return false;
+    
+    ImageFileArrayConst vLHS = getArray();
+    ImageFileArrayConst vLHSImag = getImaginaryArray();
+    ImageFileArray vRealResult = result.getArray();
+    ImageFileArray vImagResult = result.getImaginaryArray();
+    
+    unsigned int ix, iy;
+    
+    // alloc output matrix
+    CTSimComplex** complexOut = new CTSimComplex* [m_nx];
+    for (ix = 0; ix < m_nx; ix++)
+      complexOut[ix] = new CTSimComplex [m_ny];
+    
+    // fourier each x column
+    CTSimComplex* pY = new CTSimComplex [m_ny];
+    for (ix = 0; ix < m_nx; ix++) {
+      for (iy = 0; iy < m_ny; iy++) {
+        double dImag = 0;
+        if (isComplex())
+          dImag = vLHSImag[ix][iy];
+        pY[iy] = std::complex<double>(vLHS[ix][iy], dImag);
+      } 
+      ProcessSignal::finiteFourierTransform (pY, complexOut[ix], m_ny,  ProcessSignal::FORWARD);
+    }
+    delete [] pY;
+    
+    // fourier each y row
+    CTSimComplex* pX = new CTSimComplex [m_nx];
+    CTSimComplex* complexOutRow = new CTSimComplex [m_nx];
+    for (iy = 0; iy < m_ny; iy++) {
+      for (ix = 0; ix < m_nx; ix++)
+        pX[ix] = complexOut[ix][iy];
+      ProcessSignal::finiteFourierTransform (pX, complexOutRow, m_nx, ProcessSignal::FORWARD);
+      for (ix = 0; ix < m_nx; ix++)
+        complexOut[ix][iy] = complexOutRow[ix];
+    }
+    delete [] pX;
+    delete [] complexOutRow;
+    
+    for (ix = 0; ix < m_nx; ix++)
+      for (iy = 0; iy < m_ny; iy++) {
+        vRealResult[ix][iy] = complexOut[ix][iy].real();
+        vImagResult[ix][iy] = complexOut[ix][iy].imag();
+      }
+      
+      Fourier::shuffleFourierToNaturalOrder (result);
+      
+      // delete complexOut matrix
+      for (ix = 0; ix < m_nx; ix++)
+        delete [] complexOut[ix];
+      delete [] complexOut;
+      
+      return true;
+}
+
+bool
+ImageFile::inverseFourier (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  if (result.dataType() == Array2dFile::DATA_TYPE_REAL) {
+    if (! result.convertRealToComplex ())
+      return false;
+  }
+  
+  ImageFileArrayConst vLHSReal = getArray();
+  ImageFileArrayConst vLHSImag = getImaginaryArray();
+  ImageFileArray vRealResult = result.getArray();
+  ImageFileArray vImagResult = result.getImaginaryArray();
+  
+  unsigned int ix, iy;
+  // alloc 2d complex output matrix
+  CTSimComplex** complexOut = new CTSimComplex* [m_nx];
+  for (ix = 0; ix < m_nx; ix++)
+    complexOut[ix] = new CTSimComplex [m_ny];
+  
+  // put input image into result
+  for (ix = 0; ix < m_nx; ix++)
+    for (iy = 0; iy < m_ny; iy++) {
+      vRealResult[ix][iy] = vLHSReal[ix][iy];
+      if (isComplex())
+        vImagResult[ix][iy] = vLHSImag[ix][iy];
+      else
+        vImagResult[ix][iy] = 0;
+    }
+    
+    Fourier::shuffleNaturalToFourierOrder (result);
+    
+    // ifourier each x column
+    CTSimComplex* pCol = new CTSimComplex [m_ny];
+    for (ix = 0; ix < m_nx; ix++) {
+      for (iy = 0; iy < m_ny; iy++) {
+        pCol[iy] = std::complex<double> (vRealResult[ix][iy], vImagResult[ix][iy]);
+      }
+      ProcessSignal::finiteFourierTransform (pCol, complexOut[ix], m_ny,  ProcessSignal::BACKWARD);
+    }
+    delete [] pCol;
+    
+    // ifourier each y row
+    CTSimComplex* complexInRow = new CTSimComplex [m_nx];
+    CTSimComplex* complexOutRow = new CTSimComplex [m_nx];
+    for (iy = 0; iy < m_ny; iy++) {
+      for (ix = 0; ix < m_nx; ix++)
+        complexInRow[ix] = complexOut[ix][iy];
+      ProcessSignal::finiteFourierTransform (complexInRow, complexOutRow, m_nx, ProcessSignal::BACKWARD);
+      for (ix = 0; ix < m_nx; ix++)
+        complexOut[ix][iy] = complexOutRow[ix];
+    }
+    delete [] complexInRow;
+    delete [] complexOutRow;
+    
+    for (ix = 0; ix < m_nx; ix++)
+      for (iy = 0; iy < m_ny; iy++) {
+        vRealResult[ix][iy] = complexOut[ix][iy].real();
+        vImagResult[ix][iy] = complexOut[ix][iy].imag();
+      }
+      
+      // delete complexOut matrix
+      for (ix = 0; ix < m_nx; ix++)
+        delete [] complexOut[ix];
+      delete [] complexOut;
+      
+      return true;
+}
+
+
+bool
+ImageFile::magnitude (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  ImageFileArray vReal = getArray();
+  ImageFileArray vImag = getImaginaryArray();
+  ImageFileArray vRealResult = result.getArray();
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++)
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      if (isComplex()) 
+        vRealResult[ix][iy] = ::sqrt (vReal[ix][iy] * vReal[ix][iy] + vImag[ix][iy] * vImag[ix][iy]);
+      else
+        vRealResult[ix][iy] = vReal[ix][iy];
+    }
+    
+    if (result.isComplex())
+      result.convertComplexToReal();
+    
+    return true;
+}
+
+bool
+ImageFile::phase (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  ImageFileArray vReal = getArray();
+  ImageFileArray vImag = getImaginaryArray();
+  ImageFileArray vRealResult = result.getArray();
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++)
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      if (isComplex())
+        vRealResult[ix][iy] = ::atan2 (vImag[ix][iy], vReal[ix][iy]);
+      else
+        vRealResult[ix][iy] = 0;
+    }
+    
+    if (result.isComplex())
+      result.convertComplexToReal();
+    
+    return true;
+}
+
+bool
+ImageFile::square (ImageFile& result) const
+{
+  if (m_nx != result.nx() || m_ny != result.ny()) {
+    sys_error (ERR_WARNING, "Difference sizes of images [ImageFile::invertPixelValues]");
+    return false;
+  }
+  
+  if (isComplex() && ! result.isComplex())
+    result.convertRealToComplex();
+  
+  ImageFileArrayConst vLHS = getArray();
+  ImageFileArrayConst vLHSImag = getImaginaryArray();
+  ImageFileArray vResult = result.getArray();
+  ImageFileArray vResultImag = result.getImaginaryArray();
+  
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
+    for (unsigned int iy = 0; iy < m_ny; iy++) {
+      if (result.isComplex()) {
+        double dImag = 0;
+        if (isComplex())
+          dImag = vLHSImag[ix][iy];
+        std::complex<double> cLHS (vLHS[ix][iy], dImag);
+        std::complex<double> cResult = cLHS * cLHS;
+        vResult[ix][iy] = cResult.real();
+        vResultImag[ix][iy] = cResult.imag();
+      } else
+        vResult[ix][iy] = vLHS[ix][iy] * vLHS[ix][iy];
+    }
+  }
+  
+  
+  return true;
+}
+
+int
+ImageFile::convertFormatNameToID (const char* const formatName)
+{
+  int formatID = FORMAT_INVALID;
+  
+  for (int i = 0; i < s_iFormatCount; i++)
+    if (strcasecmp (formatName, s_aszFormatName[i]) == 0) {
+      formatID = i;
+      break;
+    }
+    
+    return (formatID);
+}
+
+const char*
+ImageFile::convertFormatIDToName (int formatID)
+{
+  static const char *formatName = "";
+  
+  if (formatID >= 0 && formatID < s_iFormatCount)
+    return (s_aszFormatName[formatID]);
+  
+  return (formatName);
+}
+
+const char*
+ImageFile::convertFormatIDToTitle (const int formatID)
+{
+  static const char *formatTitle = "";
+  
+  if (formatID >= 0 && formatID < s_iFormatCount)
+    return (s_aszFormatTitle[formatID]);
+  
+  return (formatTitle);
+}
+
+bool
+ImageFile::exportImage (const char* const pszFormat, const char* const pszFilename, int nxcell, int nycell, double densmin, double densmax)
+{
+  int iFormatID = convertFormatNameToID (pszFormat);
+  if (iFormatID == FORMAT_INVALID) {
+    sys_error (ERR_SEVERE, "Invalid format %s [ImageFile::exportImage]", pszFormat);
+    return false;
+  }
+  
+  if (iFormatID == FORMAT_PGM)
+    return writeImagePGM (pszFilename, nxcell, nycell, densmin, densmax);
+  else if (iFormatID == FORMAT_PGMASCII)
+    return writeImagePGMASCII (pszFilename, nxcell, nycell, densmin, densmax);
+  else if (iFormatID == FORMAT_PNG)
+    return writeImagePNG (pszFilename, 8, nxcell, nycell, densmin, densmax);
+  else if (iFormatID == FORMAT_PNG16)
+    return writeImagePNG (pszFilename, 16, nxcell, nycell, densmin, densmax);
+  
+  sys_error (ERR_SEVERE, "Invalid format %s [ImageFile::exportImage]", pszFormat);
+  return false;
+}
+
 bool
 ImageFile::writeImagePGM (const char* const outfile, int nxcell, int nycell, double densmin, double densmax)
 {
@@ -1144,10 +1144,10 @@ ImageFile::writeImagePGM (const char* const outfile, int nxcell, int nycell, dou
         fputc( rowp[ic], fp );
     }
   }
-  \r
+  
   delete rowp;
-  fclose(fp);\r
-  \r
+  fclose(fp);
+  
   return true;
 }
 
@@ -1183,10 +1183,10 @@ ImageFile::writeImagePGMASCII (const char* const outfile, int nxcell, int nycell
       fprintf(fp, "\n");
     }
   }
-  \r
+  
   delete rowp;
-  fclose(fp);\r
-  \r
+  fclose(fp);
+  
   return true;
 }
 
@@ -1202,7 +1202,7 @@ ImageFile::writeImagePNG (const char* const outfile, int bitdepth, int nxcell, i
   
   unsigned char* rowp = new unsigned char [nx * nxcell * (bitdepth / 8)];
   
-  FILE *fp = fopen (outfile, "wb");\r
+  FILE *fp = fopen (outfile, "wb");
   if (! fp)
     return false;
   
@@ -1253,10 +1253,10 @@ ImageFile::writeImagePNG (const char* const outfile, int bitdepth, int nxcell, i
   
   png_write_end (png_ptr, info_ptr);
   png_destroy_write_struct (&png_ptr, &info_ptr);
-  delete rowp;\r
+  delete rowp;
+  
+  fclose(fp);
   
-  fclose(fp);\r
-  \r
   return true;
 }
 #endif
@@ -1295,17 +1295,17 @@ ImageFile::writeImageGIF (const char* const outfile, int nxcell, int nycell, dou
     }
   }
   
-  FILE *out;\r
+  FILE *out;
   if ((out = fopen (outfile,"w")) == NULL) {
     sys_error(ERR_FATAL, "Error opening output file %s for writing", outfile);
     return false;
   }
   gdImageGif(gif,out);
   fclose(out);
-  gdImageDestroy(gif);\r
-  \r
-  delete rowp;\r
-  \r
+  gdImageDestroy(gif);
+  
+  delete rowp;
+  
   return true;
 }
 #endif
index b74e531930a067cbc295b0b36a7075e29b77d9f8..467c8e90d5f4eab03f48533433240384ebda42f2 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phantom.cpp,v 1.25 2001/01/02 07:47:36 kevin Exp $
+**  $Id: phantom.cpp,v 1.26 2001/01/02 16:02:13 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
@@ -27,8 +27,8 @@
 
 #include "ct.h"
 
-const int PhantomElement::POINTS_PER_CIRCLE = 360;\r
-const double PhantomElement::SCALE_PELEM_EXTENT=0.005;  // increase pelem limits by 0.5% \r
+const int PhantomElement::POINTS_PER_CIRCLE = 360;
+const double PhantomElement::SCALE_PELEM_EXTENT=0.005;  // increase pelem limits by 0.5% 
 
 const int Phantom::PHM_INVALID = -1;
 const int Phantom::PHM_HERMAN = 0;
@@ -226,15 +226,15 @@ Phantom::createFromFile (const char* const fname)
   return (bGoodFile);
 }
 
-bool\r
-Phantom::fileWrite (const char* const fname)\r
-{\r
-  fstream file (fname, ios::out);\r
-\r
-  if (! file.fail())\r
-    printDefinitions (file);\r
-  return ! file.fail();\r
-}\r
+bool
+Phantom::fileWrite (const char* const fname)
+{
+  fstream file (fname, ios::out);
+
+  if (! file.fail())
+    printDefinitions (file);
+  return ! file.fail();
+}
 
 /* NAME
  *   addPElem          Add pelem
@@ -288,12 +288,12 @@ Phantom::print (std::ostream& os) const
   os << "Number of PElements: " << m_nPElem << "\n";
   os << "Limits: xmin=" << m_xmin << ", ymin=" << m_ymin << ", xmax=" << m_xmax << ", ymax=" << m_ymax << "\n";
   
-  for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) {\r
+  for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) {
     const PhantomElement& rPE = **i;
-      os << "PhantomElement: nPoints=" << rPE.nOutlinePoints();\r
+      os << "PhantomElement: nPoints=" << rPE.nOutlinePoints();
       os << ", atten=" << rPE.atten() << " rot=" << convertRadiansToDegrees (rPE.rot()) << "\n";
       os << "xmin=" << rPE.xmin() << ", ymin=" << rPE.ymin() << ", xmax=" << rPE.xmax() << ", ymax=" << rPE.ymax() << "\n";
-    \r
+    
       if (false)
         for (int i = 0; i < rPE.nOutlinePoints(); i++)
           os << rPE.xOutline()[i] << "," << rPE.yOutline()[i] << "\n";
@@ -305,36 +305,36 @@ Phantom::print (std::ostringstream& os) const
   os << "Number of PElements: " << m_nPElem << "\n";
   os << "Limits: xmin=" << m_xmin << ", ymin=" << m_ymin << ", xmax=" << m_xmax << ", ymax=" << m_ymax << "\n";
   
-  for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) {\r
+  for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) {
     const PhantomElement& rPE = **i;
-      os << "PhantomElement: nPoints=" << rPE.nOutlinePoints();\r
+      os << "PhantomElement: nPoints=" << rPE.nOutlinePoints();
       os << ", atten=" << rPE.atten() << " rot=" << convertRadiansToDegrees (rPE.rot()) << "\n";
       os << "xmin=" << rPE.xmin() << ", ymin=" << rPE.ymin() << ", xmax=" << rPE.xmax() << ", ymax=" << rPE.ymax() << "\n";
-    \r
+    
       if (false)
         for (int i = 0; i < rPE.nOutlinePoints(); i++)
           os << rPE.xOutline()[i] << "," << rPE.yOutline()[i] << "\n";
   }
 }
-\r
-void\r
-Phantom::printDefinitions (std::ostream& os) const\r
-{\r
-  for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) {\r
-    const PhantomElement& rPE = **i;\r
-    rPE.printDefinition (os);\r
-  }\r
-}
-\r
-void\r
-Phantom::printDefinitions (std::ostringstream& os) const\r
-{\r
-  for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) {\r
-    const PhantomElement& rPE = **i;\r
-    rPE.printDefinition (os);\r
-  }\r
-}
-\r
+
+void
+Phantom::printDefinitions (std::ostream& os) const
+{
+  for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) {
+    const PhantomElement& rPE = **i;
+    rPE.printDefinition (os);
+  }
+}
+
+void
+Phantom::printDefinitions (std::ostringstream& os) const
+{
+  for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) {
+    const PhantomElement& rPE = **i;
+    rPE.printDefinition (os);
+  }
+}
+
 
 /* NAME
  *   show              Show vector outline of Phantom to user
@@ -550,13 +550,13 @@ Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trac
   if (nsample > 1) {
     double factor = 1.0 / static_cast<double>(nsample * nsample);
 
-\r
+
     for (int ix = 0; ix < colCount; ix++) {
-               int iColStore = ix;\r
-               if (bStoreAtColumnPos)\r
-                       iColStore += colStart;\r
+               int iColStore = ix;
+               if (bStoreAtColumnPos)
+                       iColStore += colStart;
                for (int iy = 0; iy < ny; iy++)
-                       v[iColStore][iy] *= factor;\r
+                       v[iColStore][iy] *= factor;
        }
   }
 }
@@ -594,27 +594,27 @@ PhantomElement::PhantomElement (const char *type, const double cx, const double
   m_rectLimits[2] = m_xmax;   m_rectLimits[3] = m_ymax;
 }
 
-\r
+
 
 PhantomElement::~PhantomElement ()
 {
     delete m_xOutline;
     delete m_yOutline;
 }
-\r
-void\r
-PhantomElement::printDefinition (std::ostream& os) const\r
-{\r
-  os << convertTypeToName (m_type) << " " << m_cx << " " << m_cy << " " << m_u << " "\r
-    << m_v << " " << convertRadiansToDegrees (m_rot) << " " << m_atten << "\n";\r
-}\r
-
-void\r
-PhantomElement::printDefinition (std::ostringstream& os) const\r
-{\r
-  os << convertTypeToName (m_type) << " " << m_cx << " " << m_cy << " " << m_u << " "\r
-    << m_v << " " << convertRadiansToDegrees (m_rot) << " " << m_atten << "\n";\r
-}\r
+
+void
+PhantomElement::printDefinition (std::ostream& os) const
+{
+  os << convertTypeToName (m_type) << " " << m_cx << " " << m_cy << " " << m_u << " "
+    << m_v << " " << convertRadiansToDegrees (m_rot) << " " << m_atten << "\n";
+}
+
+void
+PhantomElement::printDefinition (std::ostringstream& os) const
+{
+  os << convertTypeToName (m_type) << " " << m_cx << " " << m_cy << " " << m_u << " "
+    << m_v << " " << convertRadiansToDegrees (m_rot) << " " << m_atten << "\n";
+}
 
 PhmElemType
 PhantomElement::convertNameToType (const char* const typeName)
@@ -636,26 +636,26 @@ PhantomElement::convertNameToType (const char* const typeName)
 
     return (type);
 }
-\r
-const char* const\r
-PhantomElement::convertTypeToName (PhmElemType iType)\r
-{\r
-  static char* pszType = "Unknown";\r
-\r
-  if (iType == PELEM_RECTANGLE)\r
-    pszType = "rectangle";\r
-  else if (iType == PELEM_TRIANGLE)\r
-    pszType = "triangle";\r
-  else if (iType == PELEM_ELLIPSE)\r
-    pszType = "ellipse";\r
-  else if (iType == PELEM_SECTOR)\r
-    pszType = "sector";\r
-  else if (iType == PELEM_SEGMENT)\r
-    pszType = "segment";\r
-\r
-  return pszType;\r
-}\r
-\r
+
+const char* const
+PhantomElement::convertTypeToName (PhmElemType iType)
+{
+  static char* pszType = "Unknown";
+
+  if (iType == PELEM_RECTANGLE)
+    pszType = "rectangle";
+  else if (iType == PELEM_TRIANGLE)
+    pszType = "triangle";
+  else if (iType == PELEM_ELLIPSE)
+    pszType = "ellipse";
+  else if (iType == PELEM_SECTOR)
+    pszType = "sector";
+  else if (iType == PELEM_SEGMENT)
+    pszType = "segment";
+
+  return pszType;
+}
+
 
 void 
 PhantomElement::makeTransformMatrices ()
index 41895ac06a37308f297e000bf8cf9b1ad5b43551..71a0e67bad2121c37eb063ca893f0e70f4e7919e 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: procsignal.cpp,v 1.13 2001/01/02 05:34:57 kevin Exp $
+**  $Id: procsignal.cpp,v 1.14 2001/01/02 16:02:13 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
@@ -115,7 +115,7 @@ ProcessSignal::ProcessSignal (const char* szFilterName, const char* szFilterMeth
 
 void
 ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandwidth, double dSignalIncrement, int nSignalPoints, double dFilterParam, const int idDomain, const int idFilterGeneration, const int iZeropad, const int iPreinterpolationFactor, int iTraceLevel, int iGeometry, double dFocalLength, SGP* pSGP)
-{\r
+{
   int i;
   m_idFilter = idFilter;
   m_idDomain = idDomain;
@@ -200,7 +200,7 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
       }
 #endif
       ProcessSignal::finiteFourierTransform (adFrequencyFilter, m_adFilter, m_nFilterPoints, FORWARD);
-      delete adFrequencyFilter;\r
+      delete adFrequencyFilter;
 #ifdef HAVE_SGP
       if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
         pEZPlot->ezset ("title Inverse Fourier Frequency: Fourier Order");
@@ -335,7 +335,7 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
       if (m_traceLevel >= Trace::TRACE_CONSOLE)
         std::cout << "nFilterPoints = " << m_nFilterPoints << endl;
 #endif
-      double* adSpatialFilter = new double [m_nFilterPoints];\r
+      double* adSpatialFilter = new double [m_nFilterPoints];
       SignalFilter filter (m_idFilter, m_dFilterMin, m_dFilterMax, nSpatialPoints, m_dBandwidth, m_dFilterParam, SignalFilter::DOMAIN_SPATIAL);
       filter.copyFilterData (adSpatialFilter, 0, nSpatialPoints);
 #ifdef HAVE_SGP
@@ -364,17 +364,17 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
           double dScale = 0.5 * sinScale * sinScale;
           adSpatialFilter[i] *= dScale;
         }
-      }\r
+      }
       for (i = nSpatialPoints; i < m_nFilterPoints; i++)
         adSpatialFilter[i] = 0;
       
       m_adFilter = new double [m_nFilterPoints];
-      std::complex<double>* acInverseFilter = new std::complex<double> [m_nFilterPoints];\r
+      std::complex<double>* acInverseFilter = new std::complex<double> [m_nFilterPoints];
       finiteFourierTransform (adSpatialFilter, acInverseFilter, m_nFilterPoints, BACKWARD);
-      delete adSpatialFilter;\r
+      delete adSpatialFilter;
       for (i = 0; i < m_nFilterPoints; i++)
         m_adFilter[i] = std::abs (acInverseFilter[i]) * m_dSignalInc;
-      delete acInverseFilter;\r
+      delete acInverseFilter;
 #ifdef HAVE_SGP
       if (pEZPlot && m_traceLevel >= Trace::TRACE_PLOT) {
         pEZPlot->ezset ("title Spatial Filter: Inverse");
@@ -382,7 +382,7 @@ ProcessSignal::init (const int idFilter, const int idFilterMethod, double dBandw
         pEZPlot->ezset ("yporigin 0.50");
         pEZPlot->addCurve (m_adFilter, m_nFilterPoints);
         pEZPlot->plot (pSGP);
-        delete pEZPlot;\r
+        delete pEZPlot;
       }
 #endif
     }
@@ -528,7 +528,7 @@ void
 ProcessSignal::filterSignal (const float constInput[], double output[]) const
 {
   double* input = new double [m_nSignalPoints];
-  int i;\r
+  int i;
   for (i = 0; i < m_nSignalPoints; i++)
     input[i] = constInput[i];
   
@@ -542,7 +542,7 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
       int iDetFromCenter = i - (m_nSignalPoints / 2);
       input[i] *= m_dFocalLength * cos (iDetFromCenter * m_dSignalInc);
     }
-  }\r
+  }
   if (m_idFilterMethod == FILTER_METHOD_CONVOLUTION) {
     for (i = 0; i < m_nSignalPoints; i++)
       output[i] = convolve (input, m_dSignalInc, i, m_nSignalPoints);
@@ -553,15 +553,15 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
     for (i = m_nSignalPoints; i < m_nFilterPoints; i++)
       inputSignal[i] = 0;  // zeropad
     std::complex<double>* fftSignal = new std::complex<double> [m_nFilterPoints];
-    finiteFourierTransform (inputSignal, fftSignal, m_nFilterPoints, FORWARD);\r
+    finiteFourierTransform (inputSignal, fftSignal, m_nFilterPoints, FORWARD);
     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, BACKWARD);\r
+    finiteFourierTransform (fftSignal, inverseFourier, m_nFilterPoints, BACKWARD);
     delete fftSignal;
     for (i = 0; i < m_nSignalPoints; i++) 
-      output[i] = inverseFourier[i];\r
+      output[i] = inverseFourier[i];
     delete inverseFourier;
   } else if (m_idFilterMethod == FILTER_METHOD_FOURIER_TABLE) {
     double* inputSignal = new double [m_nFilterPoints];
@@ -570,15 +570,15 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
     for (i = m_nSignalPoints; i < m_nFilterPoints; i++)
       inputSignal[i] = 0;  // zeropad
     std::complex<double>* fftSignal = new std::complex<double> [m_nFilterPoints];
-    finiteFourierTransform (inputSignal, fftSignal, FORWARD);\r
+    finiteFourierTransform (inputSignal, fftSignal, FORWARD);
     delete inputSignal;
     for (i = 0; i < m_nFilterPoints; i++)
       fftSignal[i] *= m_adFilter[i];
     double* inverseFourier = new double [m_nFilterPoints];
-    finiteFourierTransform (fftSignal, inverseFourier, BACKWARD);\r
+    finiteFourierTransform (fftSignal, inverseFourier, BACKWARD);
     delete fftSignal;
     for (i = 0; i < m_nSignalPoints; i++) 
-      output[i] = inverseFourier[i];\r
+      output[i] = inverseFourier[i];
     delete inverseFourier;
   }
 #if HAVE_FFTW
@@ -589,7 +589,7 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
     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
+      m_adRealFftSignal[i] = m_adFilter[i] * fftOutput[i];
     delete [] fftOutput;
     for (i = m_nFilterPoints; i < m_nOutputPoints; i++)
             m_adRealFftSignal[i] = 0;
@@ -597,7 +597,7 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
     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
+      output[i] = ifftOutput[i];
     delete [] ifftOutput;
   } else if (m_idFilterMethod == FILTER_METHOD_FFTW) {
     for (i = 0; i < m_nSignalPoints; i++)
@@ -608,15 +608,15 @@ ProcessSignal::filterSignal (const float constInput[], double output[]) const
     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
+      output[i] = ifftOutput[i].re;
     delete [] ifftOutput;
   }
-#endif\r
+#endif
   delete input;
 }
 
@@ -690,7 +690,7 @@ ProcessSignal::finiteFourierTransform (const double input[], double output[], co
   
   finiteFourierTransform (input, complexOutput, n, direction);
   for (int i = 0; i < n; i++)
-    output[i] = complexOutput[i].real();\r
+    output[i] = complexOutput[i].real();
   delete [] complexOutput;
 }
 
@@ -733,8 +733,8 @@ ProcessSignal::finiteFourierTransform (const std::complex<double> input[], std::
     std::complex<double> sum (0,0);
     for (int j = 0; j < n; j++) {
       double angle = i * j * angleIncrement;
-      std::complex<double> exponentTerm (cos(angle), sin(angle));\r
-      sum += input[j] * exponentTerm;\r
+      std::complex<double> exponentTerm (cos(angle), sin(angle));
+      sum += input[j] * exponentTerm;
     }
     if (direction < 0) {
       sum /= n;
index 4c31b3808748681a62e7ae33ad1c25a69ad17307..f6fff539bb7c4f6a7d7e5b8362b71cb5f09964bc 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: projections.cpp,v 1.34 2001/01/02 06:29:23 kevin Exp $
+**  $Id: projections.cpp,v 1.35 2001/01/02 16:02:13 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
@@ -25,8 +25,8 @@
 ******************************************************************************/
 
 #include "ct.h"
-\r
-const kuint16 Projections::m_signature = ('P'*256 + 'J');\r
+
+const kuint16 Projections::m_signature = ('P'*256 + 'J');
 
 /* NAME
  *    Projections              Constructor for projections matrix storage 
@@ -71,15 +71,15 @@ Projections::init (const int nView, const int nDet)
   m_nView = nView;
   m_nDet = nDet;
   newProjData ();
-\r
-  time_t t = time (NULL);\r
-  tm* lt = localtime (&t);\r
-  m_year = lt->tm_year;\r
-  m_month = lt->tm_mon;\r
-  m_day = lt->tm_mday;\r
-  m_hour = lt->tm_hour;\r
-  m_minute = lt->tm_min;\r
-  m_second = lt->tm_sec;\r
+
+  time_t t = time (NULL);
+  tm* lt = localtime (&t);
+  m_year = lt->tm_year;
+  m_month = lt->tm_mon;
+  m_day = lt->tm_mday;
+  m_hour = lt->tm_hour;
+  m_minute = lt->tm_min;
+  m_second = lt->tm_sec;
 }
 
 void
@@ -271,7 +271,7 @@ Projections::headerRead (fnetorderstream& fs)
   }
   pszRemarkStorage[_remarksize] = 0;
   m_remark = pszRemarkStorage;
-  delete pszRemarkStorage;\r
+  delete pszRemarkStorage;
 
   off_t _hsizeread = fs.tellg();
   if (!fs || _hsizeread != _hsize) {
@@ -316,12 +316,12 @@ Projections::read (const std::string& filename)
 bool
 Projections::read (const char* filename)
 {
-  m_filename = filename;\r
-#ifdef MSVC\r
-  frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary);\r
-#else\r
-  frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary | std::ios::nocreate);\r
-#endif\r
+  m_filename = filename;
+#ifdef MSVC
+  frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary);
+#else
+  frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary | std::ios::nocreate);
+#endif
 
   if (fileRead.fail())
     return false;
index df456214c7b2a4066e7d9caa986c5eff9591d352..c85802749998665c64f2ebd974578e08d60e4804 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: reconstruct.cpp,v 1.6 2000/12/29 15:45:06 kevin Exp $
+**  $Id: reconstruct.cpp,v 1.7 2001/01/02 16:02:13 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
@@ -123,7 +123,7 @@ Reconstructor::plotFilter (SGP* pSGP)
       ezplot.addCurve (adPlotXAxis, m_pProcessSignal->getFilter(), nVecFilter);
       ezplot.plot (pSGP);
     }
-  }\r
+  }
   delete adPlotXAxis;
 #endif
 }
@@ -165,7 +165,7 @@ Reconstructor::reconstructView (int iStartView, int iViewCount, SGP* pSGP, bool
     }
 #endif
 #endif
-\r
+
        if (bBackprojectView)
       m_pBackprojector->BackprojectView (adFilteredProj, rDetArray.viewAngle());
 
@@ -197,7 +197,7 @@ Reconstructor::reconstructView (int iStartView, int iViewCount, SGP* pSGP, bool
     } 
 #endif  //HAVE_SGP
   }
-\r
-  delete adFilteredProj;\r
+
+  delete adFilteredProj;
 }
 
index 3ff8b0874c4f59ceda261dc5aef59fefc0144fec..e11e33442faf6802b024320ad5bc63c9c37f421e 100644 (file)
@@ -14,7 +14,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: clip.cpp,v 1.6 2000/12/06 15:17:51 kevin Exp $
+**  $Id: clip.cpp,v 1.7 2001/01/02 16:02:13 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
@@ -331,7 +331,7 @@ tcode (const double x, const double y, const double m, const double b, const int
 
 static int rectcode (double x, double y, const double rect[4]);
 
-bool\r
+bool
 clip_rect (double& x1, double& y1, double& x2, double& y2, const double rect[4])
 {
   double x = 0, y = 0;
index ffa26f0a6a5b6f7363a9dc267b9521340500d171..41d1ead4e27c29e8f251a16b7f7429767dc600de 100644 (file)
@@ -48,7 +48,7 @@ ConvertReverseNetworkOrder (void* buffer, size_t bytes)
 #endif    
 }
 
-void\r
+void
 fnetorderstream::writeInt16 (kuint16 n) {
 #ifndef WORDS_BIGENDIAN
   SwapBytes2 (&n);
@@ -56,7 +56,7 @@ fnetorderstream::writeInt16 (kuint16 n) {
   write (reinterpret_cast<const char*>(&n), 2);
 }
 
-void\r
+void
 fnetorderstream::writeInt32 (kuint32 n) {
 #ifndef WORDS_BIGENDIAN
   SwapBytes4(&n);
@@ -64,7 +64,7 @@ fnetorderstream::writeInt32 (kuint32 n) {
   write (reinterpret_cast<const char*>(&n), 4);
 }
 
-void\r
+void
 fnetorderstream::writeFloat32 (kfloat32 n) {
 #ifndef WORDS_BIGENDIAN
   SwapBytes4 (&n);
@@ -72,7 +72,7 @@ fnetorderstream::writeFloat32 (kfloat32 n) {
   write (reinterpret_cast<const char*>(&n), 4);
 }
 
-void\r
+void
 fnetorderstream::writeFloat64 (kfloat64 n) {
 #ifndef WORDS_BIGENDIAN
   SwapBytes8 (&n);
@@ -80,7 +80,7 @@ fnetorderstream::writeFloat64 (kfloat64 n) {
   write (reinterpret_cast<const char*>(&n), 8);
 }
 
-void\r
+void
 fnetorderstream::readInt16 (kuint16& n) {
   read (reinterpret_cast<char*>(&n), 2);
 #ifndef WORDS_BIGENDIAN
@@ -88,7 +88,7 @@ fnetorderstream::readInt16 (kuint16& n) {
 #endif
 }
 
-void\r
+void
 fnetorderstream::readInt32 (kuint32& n) {
   read (reinterpret_cast<char*>(&n), 4);
 #ifndef WORDS_BIGENDIAN
@@ -96,7 +96,7 @@ fnetorderstream::readInt32 (kuint32& n) {
 #endif
 }
 
-void\r
+void
 fnetorderstream::readFloat32 (kfloat32& n) {
   read (reinterpret_cast<char*>(&n), 4);
 #ifndef WORDS_BIGENDIAN
@@ -104,7 +104,7 @@ fnetorderstream::readFloat32 (kfloat32& n) {
 #endif
 }
 
-void\r
+void
 fnetorderstream::readFloat64 (kfloat64& n) {
   read (reinterpret_cast<char*>(&n), 8);
 #ifndef WORDS_BIGENDIAN
@@ -114,7 +114,7 @@ fnetorderstream::readFloat64 (kfloat64& n) {
 
 
 
-void\r
+void
 frnetorderstream::writeInt16 (kuint16 n) {
 #ifdef WORDS_BIGENDIAN
   SwapBytes2 (&n);
@@ -122,7 +122,7 @@ frnetorderstream::writeInt16 (kuint16 n) {
   write (reinterpret_cast<char*>(&n), 2);
 }
 
-void\r
+void
 frnetorderstream::writeInt32 (kuint32 n) {
 #ifdef WORDS_BIGENDIAN
   SwapBytes4(&n);
@@ -130,7 +130,7 @@ frnetorderstream::writeInt32 (kuint32 n) {
   write (reinterpret_cast<char*>(&n), 4);
 }
 
-void \r
+void 
 frnetorderstream::writeFloat32 (kfloat32 n) {
 #ifdef WORDS_BIGENDIAN
   SwapBytes4 (&n);
@@ -138,7 +138,7 @@ frnetorderstream::writeFloat32 (kfloat32 n) {
   write (reinterpret_cast<char*>(&n), 4);
 }
 
-void \r
+void 
 frnetorderstream::writeFloat64 (kfloat64 n) {
 #ifdef WORDS_BIGENDIAN
   SwapBytes8 (&n);
@@ -146,7 +146,7 @@ frnetorderstream::writeFloat64 (kfloat64 n) {
   write (reinterpret_cast<char*>(&n), 8);
 }
 
-void \r
+void 
 frnetorderstream::readInt16 (kuint16& n) {
   read (reinterpret_cast<char*>(&n), 2);
 #ifdef WORDS_BIGENDIAN
@@ -154,7 +154,7 @@ frnetorderstream::readInt16 (kuint16& n) {
 #endif
 }
 
-void \r
+void 
 frnetorderstream::readInt32 (kuint32& n) {
   read (reinterpret_cast<char*>(&n), 4);
 #ifdef WORDS_BIGENDIAN
@@ -162,7 +162,7 @@ frnetorderstream::readInt32 (kuint32& n) {
 #endif
 }
 
-void\r
+void
 frnetorderstream::readFloat32 (kfloat32& n) {
   read (reinterpret_cast<char*>(&n), 4);
 #ifdef WORDS_BIGENDIAN
@@ -170,7 +170,7 @@ frnetorderstream::readFloat32 (kfloat32& n) {
 #endif
 }
 
-void\r
+void
 frnetorderstream::readFloat64 (kfloat64& n) {
   read (reinterpret_cast<char*>(&n), 8);
 #ifdef WORDS_BIGENDIAN
index a4dd2833b7385da79c1847971d2dc08024ae1a31..d5e1e11c34b4272193b57e3168d0b5d088b70420 100644 (file)
-/*****************************************************************************\r
-** FILE IDENTIFICATION\r
-**\r
-**   Hash Table Class\r
-**\r
-**  This is part of the CTSim program\r
-**  Copyright (C) 1983-2000 Kevin Rosenberg\r
-**\r
-**  $Id: hashtable.cpp,v 1.1 2000/12/27 20:09:19 kevin Exp $\r
-**\r
-**  This program is free software; you can redistribute it and/or modify\r
-**  it under the terms of the GNU General Public License (version 2) as\r
-**  published by the Free Software Foundation.\r
-**\r
-**  This program is distributed in the hope that it will be useful,\r
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-**  GNU General Public License for more details.\r
-**\r
-**  You should have received a copy of the GNU General Public License\r
-**  along with this program; if not, write to the Free Software\r
-**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
-******************************************************************************/\r
-\r
-#include "ct.h"\r
-#include <math.h>\r
-#include <stdio.h>\r
-#include <ctype.h>\r
-#include "ctsupport.h"\r
-#include "pol.h"\r
-\r
-\r
-KeywordCodeEntry::KeywordCodeEntry (const char* const pszKeyword, int iCode)\r
-    : m_iCode (iCode), m_pNext(NULL)\r
-{\r
-   int nLength = strlen (pszKeyword);\r
-   char* pszCopy = new char [ nLength + 1];\r
-   for (int i = 0; i < nLength; i++) \r
-     pszCopy[i] = tolower (pszKeyword[i]);\r
-   pszCopy[nLength] = 0;\r
-\r
-   m_strKeyword = pszCopy;\r
-\r
-   delete pszCopy;\r
-}\r
-\r
-\r
-bool\r
-KeywordCodeEntry::matchesKeyword (const char* const pszCompare) const\r
-{\r
-    int nLength = strlen (pszCompare);\r
-    char* pszCopy = new char [ nLength + 1];\r
-    for (int i = 0; i < nLength; i++) \r
-      pszCopy[i] = tolower (pszCompare[i]);\r
-    pszCopy[nLength] = 0;\r
-\r
-    bool bMatch = false;\r
-    if (m_strKeyword.compare (pszCompare) == 0)\r
-      bMatch = true;\r
-\r
-    delete pszCopy;\r
-\r
-    return bMatch;\r
-}\r
-\r
-\r
-// inittable (table)\r
-//    clear symbol table\r
-\r
-void \r
-KeywordCodeHashTable::initTable ()\r
-{\r
-       int i;\r
-\r
-       for (i = 0; i < HASHSIZE; i++)\r
-           m_hashTable[i] = NULL;\r
-}\r
-\r
-// freetable (table)\r
-//     free all memory allocated to table, then clear table\r
-\r
-void \r
-KeywordCodeHashTable::freeTable ()\r
-{\r
-       int i;\r
-       KeywordCodeEntry *p, *np;\r
-\r
-       for (i = 0; i < HASHSIZE; i++) {\r
-           np = m_hashTable [i];\r
-           while (np != NULL) {\r
-                   p = np->getNext();\r
-                   delete np;\r
-                   np = p;\r
-      }\r
-       }\r
-       initTable ();\r
-}\r
-\r
-\r
-// form hash value of string s \r
-int \r
-KeywordCodeHashTable::hash (const char* s)\r
-{\r
-       int hashval = 0;\r
-\r
-  while (*s != EOS) {\r
-           hashval += tolower(*s);\r
-      s++;\r
-  }\r
-\r
-       return (hashval % HASHSIZE);\r
-}\r
-\r
-\r
-/* Look for s in hash table */\r
-KeywordCodeEntry *\r
-KeywordCodeHashTable::lookup (const char* const pszLookup)\r
-{\r
-    KeywordCodeEntry *found = NULL;\r
-    for (KeywordCodeEntry* np = m_hashTable[ hash( pszLookup ) ]; np != NULL; np = np->getNext())\r
-           if (np->matchesKeyword (pszLookup)) {\r
-             found = np;               // found it \r
-             break;\r
-       }\r
-\r
-  return (found);\r
-}\r
-\r
-void\r
-KeywordCodeHashTable::installKeywordCode (const char* const pszKeyword, int iCode)\r
-{\r
-    KeywordCodeEntry *np = lookup (pszKeyword);\r
-\r
-    if (np == NULL) {      // not found \r
-           np = new KeywordCodeEntry (pszKeyword, iCode);\r
-           int hashval = hash (np->getKeyword());\r
-       np->setNext (m_hashTable[ hashval ]);\r
-           m_hashTable[hashval] = np;\r
-    } else                                     // already defined\r
-           np->setCode (iCode);\r
-}\r
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+**   Hash Table Class
+**
+**  This is part of the CTSim program
+**  Copyright (C) 1983-2000 Kevin Rosenberg
+**
+**  $Id: hashtable.cpp,v 1.2 2001/01/02 16:02:13 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
+**  published by the Free Software Foundation.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+******************************************************************************/
+
+#include "ct.h"
+#include <math.h>
+#include <stdio.h>
+#include <ctype.h>
+#include "ctsupport.h"
+#include "pol.h"
+
+
+KeywordCodeEntry::KeywordCodeEntry (const char* const pszKeyword, int iCode)
+    : m_iCode (iCode), m_pNext(NULL)
+{
+   int nLength = strlen (pszKeyword);
+   char* pszCopy = new char [ nLength + 1];
+   for (int i = 0; i < nLength; i++) 
+     pszCopy[i] = tolower (pszKeyword[i]);
+   pszCopy[nLength] = 0;
+
+   m_strKeyword = pszCopy;
+
+   delete pszCopy;
+}
+
+
+bool
+KeywordCodeEntry::matchesKeyword (const char* const pszCompare) const
+{
+    int nLength = strlen (pszCompare);
+    char* pszCopy = new char [ nLength + 1];
+    for (int i = 0; i < nLength; i++) 
+      pszCopy[i] = tolower (pszCompare[i]);
+    pszCopy[nLength] = 0;
+
+    bool bMatch = false;
+    if (m_strKeyword.compare (pszCompare) == 0)
+      bMatch = true;
+
+    delete pszCopy;
+
+    return bMatch;
+}
+
+
+// inittable (table)
+//    clear symbol table
+
+void 
+KeywordCodeHashTable::initTable ()
+{
+       int i;
+
+       for (i = 0; i < HASHSIZE; i++)
+           m_hashTable[i] = NULL;
+}
+
+// freetable (table)
+//     free all memory allocated to table, then clear table
+
+void 
+KeywordCodeHashTable::freeTable ()
+{
+       int i;
+       KeywordCodeEntry *p, *np;
+
+       for (i = 0; i < HASHSIZE; i++) {
+           np = m_hashTable [i];
+           while (np != NULL) {
+                   p = np->getNext();
+                   delete np;
+                   np = p;
+      }
+       }
+       initTable ();
+}
+
+
+// form hash value of string s 
+int 
+KeywordCodeHashTable::hash (const char* s)
+{
+       int hashval = 0;
+
+  while (*s != EOS) {
+           hashval += tolower(*s);
+      s++;
+  }
+
+       return (hashval % HASHSIZE);
+}
+
+
+/* Look for s in hash table */
+KeywordCodeEntry *
+KeywordCodeHashTable::lookup (const char* const pszLookup)
+{
+    KeywordCodeEntry *found = NULL;
+    for (KeywordCodeEntry* np = m_hashTable[ hash( pszLookup ) ]; np != NULL; np = np->getNext())
+           if (np->matchesKeyword (pszLookup)) {
+             found = np;               // found it 
+             break;
+       }
+
+  return (found);
+}
+
+void
+KeywordCodeHashTable::installKeywordCode (const char* const pszKeyword, int iCode)
+{
+    KeywordCodeEntry *np = lookup (pszKeyword);
+
+    if (np == NULL) {      // not found 
+           np = new KeywordCodeEntry (pszKeyword, iCode);
+           int hashval = hash (np->getKeyword());
+       np->setNext (m_hashTable[ hashval ]);
+           m_hashTable[hashval] = np;
+    } else                                     // already defined
+           np->setCode (iCode);
+}
index c9b18ac3da75ca61cf6c10e82bfe5689a4bca0a7..c6dd98dafc0c3188eccda386b43e5eb7a81a3f03 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: mathfuncs.cpp,v 1.6 2001/01/02 05:34:57 kevin Exp $
+**  $Id: mathfuncs.cpp,v 1.7 2001/01/02 16:02:13 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,57 +81,57 @@ normalizeAngle (double theta)
   
   return (theta);
 }
-\r
-\r
-void \r
-vectorNumericStatistics (std::vector<double> vec, const int nPoints, double& min, double& max, double& mean, double& mode, double& median, double& stddev)\r
-{\r
-  if (nPoints <= 0)\r
-    return;\r
-  \r
-  mean = 0;\r
-  min = vec[0];\r
-  max = vec[0];\r
-  int i;\r
-  for (i = 0; i < nPoints; i++) {\r
-    double v = vec[i];\r
-    if (v > max)\r
-      max = v;\r
-    if (v < min)\r
-      min = v;\r
-    mean += v;\r
-  }\r
-  mean /= nPoints;\r
-  \r
-  static const int nbin = 1024;\r
-  int hist[ nbin ] = {0};\r
-  double spread = max - min;\r
-  mode = 0;\r
-  stddev = 0;\r
-  for (i = 0; i < nPoints; i++) {\r
-    double v = vec[i];\r
-    int b = static_cast<int>((((v - min) / spread) * (nbin - 1)) + 0.5);\r
-    hist[b]++;\r
-    double diff = (v - mean);\r
-    stddev += diff * diff;\r
-  }\r
-  stddev = sqrt (stddev / nPoints);\r
-  \r
-  int max_binindex = 0;\r
-  int max_bin = -1;\r
-  for (int ibin = 0; ibin < nbin; ibin++) {\r
-    if (hist[ibin] > max_bin) {\r
-      max_bin = hist[ibin];\r
-      max_binindex = ibin;\r
-    }\r
-  }\r
-  \r
-  mode = (max_binindex * spread / (nbin - 1)) + min;\r
-  \r
-  std::sort(vec.begin(), vec.end());\r
-  \r
-  if (nPoints % 2)  // Odd\r
-    median = vec[((nPoints - 1) / 2)];\r
-  else        // Even\r
-    median = (vec[ (nPoints / 2) - 1 ] + vec[ nPoints / 2 ]) / 2;\r
-}\r
+
+
+void 
+vectorNumericStatistics (std::vector<double> vec, const int nPoints, double& min, double& max, double& mean, double& mode, double& median, double& stddev)
+{
+  if (nPoints <= 0)
+    return;
+  
+  mean = 0;
+  min = vec[0];
+  max = vec[0];
+  int i;
+  for (i = 0; i < nPoints; i++) {
+    double v = vec[i];
+    if (v > max)
+      max = v;
+    if (v < min)
+      min = v;
+    mean += v;
+  }
+  mean /= nPoints;
+  
+  static const int nbin = 1024;
+  int hist[ nbin ] = {0};
+  double spread = max - min;
+  mode = 0;
+  stddev = 0;
+  for (i = 0; i < nPoints; i++) {
+    double v = vec[i];
+    int b = static_cast<int>((((v - min) / spread) * (nbin - 1)) + 0.5);
+    hist[b]++;
+    double diff = (v - mean);
+    stddev += diff * diff;
+  }
+  stddev = sqrt (stddev / nPoints);
+  
+  int max_binindex = 0;
+  int max_bin = -1;
+  for (int ibin = 0; ibin < nbin; ibin++) {
+    if (hist[ibin] > max_bin) {
+      max_bin = hist[ibin];
+      max_binindex = ibin;
+    }
+  }
+  
+  mode = (max_binindex * spread / (nbin - 1)) + min;
+  
+  std::sort(vec.begin(), vec.end());
+  
+  if (nPoints % 2)  // Odd
+    median = vec[((nPoints - 1) / 2)];
+  else        // Even
+    median = (vec[ (nPoints / 2) - 1 ] + vec[ nPoints / 2 ]) / 2;
+}
index 99e1caa85f6313fe33250f192939d6c5aecf149a..3cdfabdf17c6a76f22ad25dfa8319e8d43e09690 100644 (file)
@@ -5,4 +5,4 @@
 const  fpos_t std::_Fpz = 0;
 #endif
 
-\r
+
index be54e569e6dcb95d3f5f9f47ca954b9d91f5c423..b7e1d57584ec6d6942d00ca6fbd3f86d21e29c37 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: plotfile.cpp,v 1.9 2001/01/02 07:47:36 kevin Exp $
+**  $Id: plotfile.cpp,v 1.10 2001/01/02 16:02:13 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
@@ -40,7 +40,7 @@
 PlotFile::PlotFile (int nCurves, int nRecords)
 {
   initHeaders ();
-  setCurveSize (nCurves, nRecords);\r
+  setCurveSize (nCurves, nRecords);
 }
 
 PlotFile::PlotFile ()
@@ -57,9 +57,9 @@ PlotFile::initHeaders ()
 {
   m_iNumColumns = 0;
   m_iNumRecords = 0;
-  time_t currentTime = time (NULL);\r
-  m_strDate = ctime (&currentTime);\r
-  m_vecStrDescriptions.clear();\r
+  time_t currentTime = time (NULL);
+  m_strDate = ctime (&currentTime);
+  m_vecStrDescriptions.clear();
   m_vecStrEzsetCommands.clear();
 }
 
@@ -71,9 +71,9 @@ PlotFile::setCurveSize (int nCols, int nRecords)
   m_vecCurves.clear();
   m_vecCurves.reserve (m_iNumColumns * m_iNumRecords);
 }
-\r
-// Storage format\r
-//   a Column's records are stored sequentially. It begins at iCol * m_iNumRecords\r
+
+// Storage format
+//   a Column's records are stored sequentially. It begins at iCol * m_iNumRecords
 
 bool
 PlotFile::addColumn (int iCol, const double* const pdColData)
@@ -89,83 +89,83 @@ PlotFile::addColumn (int iCol, const double* const pdColData)
   return true;
 }
 
-bool\r
-PlotFile::addColumn (int iCol, const float* const pdColData)\r
-{\r
-  if (iCol < 0 || iCol >= m_iNumColumns) {\r
-    sys_error (ERR_SEVERE, "Illegal column number %d [PlotFile::addColumn]", iCol);\r
-    return (false);\r
-  }\r
-  \r
-  for (int iRec = 0; iRec < m_iNumRecords; iRec++)\r
-    m_vecCurves[ iRec + (iCol * m_iNumRecords) ] = pdColData [iRec];\r
-  \r
-  return true;\r
-}\r
-\r
-void\r
-PlotFile::getColumn (int iCol, double* pdColData) const\r
-{\r
-  if (iCol < 0 || iCol >= m_iNumColumns) {\r
-    sys_error (ERR_SEVERE, "Illegal column number %d [PlotFile::addColumn]", iCol);\r
-    return;\r
-  }\r
-  \r
-  for (int iRec = 0; iRec < m_iNumRecords; iRec++)\r
-    pdColData[iRec] = m_vecCurves[ iRec + (iCol * m_iNumRecords) ];\r
-  \r
-}\r
-\r
-bool\r
-PlotFile::getMinMax (int iStartingCol, double& dMin, double& dMax) const\r
-{\r
-  if (iStartingCol >= m_iNumColumns) {\r
-    sys_error (ERR_WARNING, "iStartingCol >= iNumColumns");\r
-    return false;\r
-  }\r
-  \r
-  int iOffset = iStartingCol * m_iNumRecords;\r
-  dMin = m_vecCurves[ 0 + iOffset ];\r
-  dMax = dMin;\r
-  \r
-  for (int iCol = iStartingCol; iCol < m_iNumColumns; iCol++) {\r
-    int iOffset = iCol * m_iNumRecords;\r
-    for (int iRec = 0; iRec < m_iNumRecords; iRec++) {\r
-      double dVal = m_vecCurves[ iRec + iOffset ];\r
-      if (dVal < dMin)\r
-        dMin = dVal;\r
-      else if (dVal > dMax)\r
-        dMax = dVal;\r
-    }\r
-  }\r
-  \r
-  return true;\r
-}\r
-\r
-bool \r
-PlotFile::statistics (int iStartingCol, double& min, double& max, double& mean, double& mode, double& median, double &stddev) const\r
-{\r
-  if (iStartingCol >= m_iNumColumns) {\r
-    sys_error (ERR_WARNING, "iStartingCol >= iNumColumns");\r
-    return false;\r
-  }\r
\r
-  int iNPoints = (m_iNumColumns - iStartingCol) * m_iNumRecords;\r
-  std::vector<double> vec;\r
-  vec.resize (iNPoints);\r
-  \r
-  int iVec = 0;\r
-  for (int iCol = iStartingCol; iCol < m_iNumColumns; iCol++) {\r
-    int iOffset = iCol * m_iNumRecords;\r
-    for (int iRec = 0; iRec < m_iNumRecords; iRec++)\r
-      vec[iVec++] = m_vecCurves[ iRec + iOffset ];\r
-  }\r
-  \r
-  vectorNumericStatistics (vec, iNPoints, min, max, mean, mode, median, stddev);\r
-  \r
-  return true;\r
-}\r
-\r
+bool
+PlotFile::addColumn (int iCol, const float* const pdColData)
+{
+  if (iCol < 0 || iCol >= m_iNumColumns) {
+    sys_error (ERR_SEVERE, "Illegal column number %d [PlotFile::addColumn]", iCol);
+    return (false);
+  }
+  
+  for (int iRec = 0; iRec < m_iNumRecords; iRec++)
+    m_vecCurves[ iRec + (iCol * m_iNumRecords) ] = pdColData [iRec];
+  
+  return true;
+}
+
+void
+PlotFile::getColumn (int iCol, double* pdColData) const
+{
+  if (iCol < 0 || iCol >= m_iNumColumns) {
+    sys_error (ERR_SEVERE, "Illegal column number %d [PlotFile::addColumn]", iCol);
+    return;
+  }
+  
+  for (int iRec = 0; iRec < m_iNumRecords; iRec++)
+    pdColData[iRec] = m_vecCurves[ iRec + (iCol * m_iNumRecords) ];
+  
+}
+
+bool
+PlotFile::getMinMax (int iStartingCol, double& dMin, double& dMax) const
+{
+  if (iStartingCol >= m_iNumColumns) {
+    sys_error (ERR_WARNING, "iStartingCol >= iNumColumns");
+    return false;
+  }
+  
+  int iOffset = iStartingCol * m_iNumRecords;
+  dMin = m_vecCurves[ 0 + iOffset ];
+  dMax = dMin;
+  
+  for (int iCol = iStartingCol; iCol < m_iNumColumns; iCol++) {
+    int iOffset = iCol * m_iNumRecords;
+    for (int iRec = 0; iRec < m_iNumRecords; iRec++) {
+      double dVal = m_vecCurves[ iRec + iOffset ];
+      if (dVal < dMin)
+        dMin = dVal;
+      else if (dVal > dMax)
+        dMax = dVal;
+    }
+  }
+  
+  return true;
+}
+
+bool 
+PlotFile::statistics (int iStartingCol, double& min, double& max, double& mean, double& mode, double& median, double &stddev) const
+{
+  if (iStartingCol >= m_iNumColumns) {
+    sys_error (ERR_WARNING, "iStartingCol >= iNumColumns");
+    return false;
+  }
+  int iNPoints = (m_iNumColumns - iStartingCol) * m_iNumRecords;
+  std::vector<double> vec;
+  vec.resize (iNPoints);
+  
+  int iVec = 0;
+  for (int iCol = iStartingCol; iCol < m_iNumColumns; iCol++) {
+    int iOffset = iCol * m_iNumRecords;
+    for (int iRec = 0; iRec < m_iNumRecords; iRec++)
+      vec[iVec++] = m_vecCurves[ iRec + iOffset ];
+  }
+  
+  vectorNumericStatistics (vec, iNPoints, min, max, mean, mode, median, stddev);
+  
+  return true;
+}
+
 bool
 PlotFile::fileWrite (const char* const filename)
 {
@@ -218,37 +218,37 @@ PlotFile::headerRead (std::iostream& fs)
     return false;
   }
   
-  initHeaders();\r
-  fs.seekg (0);\r
-  bool bFinishedHeaders = false;\r
-\r
-  fs >> m_iNumColumns;\r
-  fs >> m_iNumRecords;\r
-\r
-  if (fs.fail() || m_iNumColumns == 0 || m_iNumRecords == 0)\r
-    return false;\r
-\r
-  while (! bFinishedHeaders && ! fs.eof() && ! fs.fail()) {\r
-    char line[1024];\r
-    fs.getline (line, sizeof(line));\r
-    int iSP = 0;\r
-    while (line[iSP] == ' ')\r
-      iSP++;\r
-    if (line[iSP] == '\n' || ! line[iSP])\r
-      ;\r
-    else if (line[iSP] == '#') {\r
-      iSP++;\r
-      while (line[iSP] == ' ')\r
-        iSP++;\r
-      if (line[iSP] == '\n' || ! line[iSP])\r
-        ;\r
-      else\r
-        addDescription (&line[iSP]);\r
-    } else if (strstr (&line[iSP], "<datapoints>") != NULL) {\r
-         bFinishedHeaders = true;\r
-    } else\r
-      addEzsetCommand (&line[iSP]);\r
-  }\r
+  initHeaders();
+  fs.seekg (0);
+  bool bFinishedHeaders = false;
+
+  fs >> m_iNumColumns;
+  fs >> m_iNumRecords;
+
+  if (fs.fail() || m_iNumColumns == 0 || m_iNumRecords == 0)
+    return false;
+
+  while (! bFinishedHeaders && ! fs.eof() && ! fs.fail()) {
+    char line[1024];
+    fs.getline (line, sizeof(line));
+    int iSP = 0;
+    while (line[iSP] == ' ')
+      iSP++;
+    if (line[iSP] == '\n' || ! line[iSP])
+      ;
+    else if (line[iSP] == '#') {
+      iSP++;
+      while (line[iSP] == ' ')
+        iSP++;
+      if (line[iSP] == '\n' || ! line[iSP])
+        ;
+      else
+        addDescription (&line[iSP]);
+    } else if (strstr (&line[iSP], "<datapoints>") != NULL) {
+         bFinishedHeaders = true;
+    } else
+      addEzsetCommand (&line[iSP]);
+  }
 
   return ! fs.fail();
 }
@@ -263,15 +263,15 @@ PlotFile::headerWrite (std::iostream& fs)
   }
   
   fs.seekp (0);
-  fs << m_iNumColumns << " " << m_iNumRecords << "\n";\r
-\r
+  fs << m_iNumColumns << " " << m_iNumRecords << "\n";
+
   unsigned int i;
-  for (i = 0; i < m_vecStrEzsetCommands.size(); i++)\r
-      fs << m_vecStrEzsetCommands[i] << "\n";\r
-  \r
-  for (i = 0; i < m_vecStrDescriptions.size(); i++)\r
-      fs << "# " << m_vecStrDescriptions[i] << "\n";\r
-  \r
+  for (i = 0; i < m_vecStrEzsetCommands.size(); i++)
+      fs << m_vecStrEzsetCommands[i] << "\n";
+  
+  for (i = 0; i < m_vecStrDescriptions.size(); i++)
+      fs << "# " << m_vecStrDescriptions[i] << "\n";
+  
   if (! m_strDate.empty())
     fs << "# Date: " << m_strDate << "\n";
     
@@ -297,8 +297,8 @@ PlotFile::columnsWrite (std::iostream& fs)
   }
   
   fs << "</datapoints>\n";
-  \r
-  fs << "</plotfile>\n";\r
+  
+  fs << "</plotfile>\n";
   
   return ! fs.fail();
 }
@@ -316,21 +316,21 @@ PlotFile::columnsRead (std::iostream& fs)
     sys_error (ERR_WARNING, "Called PlotFile::columnsRead with 0 columns or records");
     return false;
   }
-\r
-  bool bTerminateEarly = false;\r
-  for (int iRec = 0; iRec < m_iNumRecords; iRec++) {\r
-    for (int iCol = 0; iCol < m_iNumColumns; iCol++) {\r
-      if (fs.eof()) {\r
-        bTerminateEarly = true;\r
-        break;\r
-      }\r
-      if (fs.fail())\r
-        break;\r
-      double d;\r
-      fs >> d;\r
-      m_vecCurves[ iRec + (iCol * m_iNumRecords) ] = d;\r
-    }\r
-  }\r
+
+  bool bTerminateEarly = false;
+  for (int iRec = 0; iRec < m_iNumRecords; iRec++) {
+    for (int iCol = 0; iCol < m_iNumColumns; iCol++) {
+      if (fs.eof()) {
+        bTerminateEarly = true;
+        break;
+      }
+      if (fs.fail())
+        break;
+      double d;
+      fs >> d;
+      m_vecCurves[ iRec + (iCol * m_iNumRecords) ] = d;
+    }
+  }
 
   return ! (bTerminateEarly || fs.fail());
 }
@@ -338,24 +338,24 @@ PlotFile::columnsRead (std::iostream& fs)
 
 void
 PlotFile::printHeaders (std::ostream& os) const
-{\r
-  os << "EZSet Commands\n";\r
-  for (unsigned int iEZ = 0; iEZ < m_vecStrEzsetCommands.size(); iEZ++)\r
-    os << m_vecStrEzsetCommands[iEZ] << "\n";\r
-\r
-  os << "Descriptions\n";\r
-  for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++)\r
+{
+  os << "EZSet Commands\n";
+  for (unsigned int iEZ = 0; iEZ < m_vecStrEzsetCommands.size(); iEZ++)
+    os << m_vecStrEzsetCommands[iEZ] << "\n";
+
+  os << "Descriptions\n";
+  for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++)
     os << m_vecStrDescriptions[iDesc] << "\n";
 }
 
 void
 PlotFile::printHeaders (std::ostringstream& os) const
-{\r
-  os << "EZSet Commands\n";\r
-  for (unsigned int iEZ = 0; iEZ < m_vecStrEzsetCommands.size(); iEZ++)\r
-    os << m_vecStrEzsetCommands[iEZ] << "\n";\r
-\r
-  os << "Descriptions\n";\r
-  for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++)\r
+{
+  os << "EZSet Commands\n";
+  for (unsigned int iEZ = 0; iEZ < m_vecStrEzsetCommands.size(); iEZ++)
+    os << m_vecStrEzsetCommands[iEZ] << "\n";
+
+  os << "Descriptions\n";
+  for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++)
     os << m_vecStrDescriptions[iDesc] << "\n";
 }
index 679ecb43d2f873540da84d66106870ade400bf46..f87b82eee3ef08d93d1a31c3699d1d55810c66ad 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: syserror.cpp,v 1.11 2000/12/29 20:11:42 kevin Exp $
+**  $Id: syserror.cpp,v 1.12 2001/01/02 16:02:13 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
@@ -22,7 +22,7 @@
 #include <exception>
 #include <stdexcept>
 #include <stdarg.h>
-#include <ctype.h>\r
+#include <ctype.h>
 #include <string>
 #include "ct.h"
 
@@ -39,7 +39,7 @@
 */
 
 static int s_reportErrorLevel = ERR_WARNING;   // Set error reporting level 
-\r
+
 bool g_bRunningWXWindows = false;
 
 void sys_error (int severity, const char *msg, ...)
@@ -47,14 +47,14 @@ void sys_error (int severity, const char *msg, ...)
   va_list arg;
   
   va_start(arg, msg);
-  \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
+  
+//  if (g_bRunningWXWindows)
+//    theApp->getLog() << strOutput.c_str();
+//  else
+    std::cout << strOutput;
 
   va_end(arg);
 }
@@ -68,9 +68,9 @@ void sys_verror (std::string& strOutput, int severity, const char *msg, va_list
   if (severity < s_reportErrorLevel)
     return;    // ignore error if less than reporting level
   
-  std::ostringstream os;\r
+  std::ostringstream os;
 
-  s_nErrorCount++;\r
+  s_nErrorCount++;
   if (severity != ERR_FATAL) {
     if (s_nErrorCount > MAX_ERROR_COUNT)
       return;
@@ -79,7 +79,7 @@ void sys_verror (std::string& strOutput, int severity, const char *msg, va_list
       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
+      os << "*****************************************************************\n";
       strOutput = os.str();
       return;
     }
@@ -94,26 +94,26 @@ void sys_verror (std::string& strOutput, int severity, const char *msg, va_list
     break;
   case ERR_WARNING:
     os << "WARNING ERROR: ";
-    break;\r
-  case ERR_TRACE:\r
-    os << "Trace: ";\r
+    break;
+  case ERR_TRACE:
+    os << "Trace: ";
     break;
   default:
     os << "Illegal error severity #" << severity << ": ";
   }
   
-  char errStr[2000];\r
+  char errStr[2000];
   
 #if HAVE_VSNPRINTF
   vsnprintf (errStr, sizeof(errStr), msg, arg);
 #elif HAVE_VSPRINTF
-  vsprintf (errStr, msg, arg);\r
-#else\r
+  vsprintf (errStr, msg, arg);
+#else
   strncpy (errStr, sizeof(errStr), "Error message not available on this platform.");
 #endif
   
   os << errStr << "\n";
-  strOutput = os.str();\r
+  strOutput = os.str();
   
   if (severity == ERR_FATAL)
     throw std::runtime_error (errStr);
@@ -160,7 +160,7 @@ sys_error_level (int severity)
 {
   if (severity == ERR_FATAL ||
     severity == ERR_SEVERE ||
-    severity == ERR_WARNING ||\r
+    severity == ERR_WARNING ||
     severity == ERR_TRACE)
     s_reportErrorLevel = severity;
   else
index 219eb9b7c1bca2d515adec5653a77900d5ad865b..f50832ec6d37f99f69c858d3dd2a87817a03089e 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: xform.cpp,v 1.4 2000/12/04 04:44:03 kevin Exp $
+**  $Id: xform.cpp,v 1.5 2001/01/02 16:02:13 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
@@ -131,9 +131,9 @@ mult_mtx2 (const GRFMTX_2D m1, const GRFMTX_2D m2, GRFMTX_2D result)
       temp[row][col] = 0;
       for (int calc = 0; calc < 3; calc++)
            temp[row][col] += m1[row][calc] * m2[calc][col];
-    }\r
-  }\r
-\r
+    }
+  }
+
   for (int r = 0; r < 3; r++)
     for (int col = 0; col < 3; col++)
       result[r][col] = temp[r][col];
index 439ae4f3066abf502cf1b2c99107f62871ae027e..fb835ad8b5a9afdaf9d62489d3a9a628be796c69 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsim.cpp,v 1.24 2001/01/02 05:34:57 kevin Exp $
+**  $Id: ctsim.cpp,v 1.25 2001/01/02 16:02:13 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
 **  along with this program; if not, write to the Free Software
 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ******************************************************************************/
-\r
-\r
-// For compilers that support precompilation, includes "wx/wx.h".\r
-#include "wx/wxprec.h"\r
-\r
-#ifdef __BORLANDC__\r
-#pragma hdrstop\r
-#endif\r
-\r
-#ifndef WX_PRECOMP\r
-#include "wx/wx.h"\r
-#endif\r
-\r
-#if !wxUSE_DOC_VIEW_ARCHITECTURE\r
-#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!\r
-#endif\r
-\r
-#include "ct.h"\r
+
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#if !wxUSE_DOC_VIEW_ARCHITECTURE
+#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
+#endif
+
+#include "ct.h"
 #include "ctsim.h"
 #include "docs.h"
 #include "views.h"
 #include "dialogs.h"
-\r
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
-#endif\r
-\r
+#endif
+
 #if defined(HAVE_GETOPT_H) || defined(HAVE_GETOPT_LONG)
-#ifdef MSVC\r
-#define __STDC__ 1\r
-#endif\r
-#include "getopt.h"\r
-#ifdef MSVC\r
-#undef __STDC__\r
+#ifdef MSVC
+#define __STDC__ 1
+#endif
+#include "getopt.h"
+#ifdef MSVC
+#undef __STDC__
 #endif
 #endif
-\r
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.24 2001/01/02 05:34:57 kevin Exp $";
+
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.25 2001/01/02 16:02:13 kevin Exp $";
 
 class CTSimApp* theApp = NULL;
 
@@ -103,11 +103,11 @@ CTSimApp::OnInit()
     
     switch (c) {
     case O_VERSION:
-      std::cout << rcsindent << std::endl;\r
-#ifdef CTSIMVERSION\r
-      std::cout << "Version: CTSIMVERSION" << std::endl;\r
-#elif defined(VERSION)\r
-      std::cout << "Version: VERSION" << std::endl;\r
+      std::cout << rcsindent << std::endl;
+#ifdef CTSIMVERSION
+      std::cout << "Version: CTSIMVERSION" << std::endl;
+#elif defined(VERSION)
+      std::cout << "Version: VERSION" << std::endl;
 #endif
       exit(0);
     case O_HELP:
@@ -185,8 +185,8 @@ IMPLEMENT_CLASS(MainFrame, wxDocParentFrame)
 BEGIN_EVENT_TABLE(MainFrame, wxDocParentFrame)
 EVT_MENU(MAINMENU_HELP_ABOUT, MainFrame::OnAbout)
 EVT_MENU(MAINMENU_HELP_CONTENTS, MainFrame::OnHelpContents)
-EVT_MENU(MAINMENU_FILE_CREATE_PHANTOM, MainFrame::OnCreatePhantom)\r
-EVT_MENU(MAINMENU_FILE_CREATE_FILTER, MainFrame::OnCreateFilter)\r
+EVT_MENU(MAINMENU_FILE_CREATE_PHANTOM, MainFrame::OnCreatePhantom)
+EVT_MENU(MAINMENU_FILE_CREATE_FILTER, MainFrame::OnCreateFilter)
 EVT_MENU(MAINMENU_FILE_EXIT, MainFrame::OnExit)
 EVT_MENU(MAINMENU_WINDOW_BASE, MainFrame::OnWindowMenu0)
 EVT_MENU(MAINMENU_WINDOW_BASE+1, MainFrame::OnWindowMenu1)
@@ -224,8 +224,8 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
   //// Make a menubar
   wxMenu *file_menu = new wxMenu;
   
-  file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...");\r
-  file_menu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter...");\r
+  file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...");
+  file_menu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter...");
   file_menu->Append(wxID_OPEN, "&Open...");
   
   file_menu->AppendSeparator();
@@ -255,107 +255,107 @@ MainFrame::MainFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const
     m_pWindowMenu->Append (m_apWindowMenuItems[i]);
     m_pWindowMenu->Enable (MAINMENU_WINDOW_BASE+i, false);
   }
-  \r
-  m_iDefaultPhantomID = Phantom::PHM_HERMAN;\r
-  m_iDefaultFilterID = SignalFilter::FILTER_BANDLIMIT;\r
-  m_iDefaultFilterDomainID = SignalFilter::DOMAIN_FREQUENCY;\r
-  m_iDefaultFilterXSize = 256;\r
-  m_iDefaultFilterYSize = 256;\r
-  m_dDefaultFilterParam = 1.;\r
-  m_dDefaultFilterBandwidth = 1.;\r
-  m_dDefaultFilterInputScale = 1.;\r
-  m_dDefaultFilterOutputScale = 1.;\r
-  \r
+  
+  m_iDefaultPhantomID = Phantom::PHM_HERMAN;
+  m_iDefaultFilterID = SignalFilter::FILTER_BANDLIMIT;
+  m_iDefaultFilterDomainID = SignalFilter::DOMAIN_FREQUENCY;
+  m_iDefaultFilterXSize = 256;
+  m_iDefaultFilterYSize = 256;
+  m_dDefaultFilterParam = 1.;
+  m_dDefaultFilterBandwidth = 1.;
+  m_dDefaultFilterInputScale = 1.;
+  m_dDefaultFilterOutputScale = 1.;
+  
 }
 
 void 
 MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
-{\r
-  wxString msg = "CTSim\nThe Open Source Computed Tomography Simulator\n";\r
-#ifdef CTSIMVERSION\r
-  msg += "Version ";\r
-  msg += CTSIMVERSION;\r
-  msg += "\n\n";\r
-#elif defined(VERSION)\r
-  msg << "Version: " <<  VERSION << "\n\n";\r
-#endif\r
-  msg += "Author: Kevin Rosenberg <kevin@rosenberg.net>\nUsage: ctsim [files-to-open..] [--help]";\r
+{
+  wxString msg = "CTSim\nThe Open Source Computed Tomography Simulator\n";
+#ifdef CTSIMVERSION
+  msg += "Version ";
+  msg += CTSIMVERSION;
+  msg += "\n\n";
+#elif defined(VERSION)
+  msg << "Version: " <<  VERSION << "\n\n";
+#endif
+  msg += "Author: Kevin Rosenberg <kevin@rosenberg.net>\nUsage: ctsim [files-to-open..] [--help]";
   
   wxMessageBox(msg, "About CTSim", wxOK | wxICON_INFORMATION, this);
 }
-\r
-void \r
-MainFrame::OnCreatePhantom(wxCommandEvent& WXUNUSED(event))\r
-{\r
-  DialogGetPhantom dialogPhantom (this, m_iDefaultPhantomID);\r
-  int dialogReturn = dialogPhantom.ShowModal();\r
-  if (dialogReturn == wxID_OK) {\r
-    wxString selection (dialogPhantom.getPhantom());\r
-    *theApp->getLog() << "Selected phantom " << selection.c_str() << "\n";\r
-    wxString filename = selection + ".phm";\r
-    m_iDefaultPhantomID = Phantom::convertNameToPhantomID (selection.c_str());\r
-    theApp->getDocManager()->CreateDocument(filename, wxDOC_SILENT);\r
-  }\r
-  \r
-}\r
-\r
-void \r
-MainFrame::OnCreateFilter (wxCommandEvent& WXUNUSED(event))\r
-{\r
-  DialogGetFilterParameters dialogFilter (this, m_iDefaultFilterXSize, m_iDefaultFilterYSize, m_iDefaultFilterID, m_dDefaultFilterParam, m_dDefaultFilterBandwidth, m_iDefaultFilterDomainID, m_dDefaultFilterInputScale, m_dDefaultFilterOutputScale);\r
-  int dialogReturn = dialogFilter.ShowModal();\r
-  if (dialogReturn == wxID_OK) {\r
-    wxString strFilter (dialogFilter.getFilterName());\r
-    wxString strDomain (dialogFilter.getDomainName());\r
-    m_iDefaultFilterID = SignalFilter::convertFilterNameToID (strFilter.c_str());\r
-    m_iDefaultFilterDomainID = SignalFilter::convertDomainNameToID (strDomain.c_str());\r
-    m_iDefaultFilterXSize = dialogFilter.getXSize();\r
-    m_iDefaultFilterYSize = dialogFilter.getYSize();\r
-    m_dDefaultFilterBandwidth = dialogFilter.getBandwidth();\r
-    m_dDefaultFilterParam= dialogFilter.getFilterParam();\r
-    m_dDefaultFilterInputScale = dialogFilter.getInputScale();\r
-    m_dDefaultFilterOutputScale = dialogFilter.getOutputScale();\r
-    std::ostringstream os;\r
-    os << "Generate Filter=" << strFilter.c_str() \r
-      << ", size=(" << static_cast<int>(m_iDefaultFilterXSize) << "," << static_cast<int>(m_iDefaultFilterYSize) \r
-      << "), domain=" << strDomain.c_str() << ", filterParam=" << m_dDefaultFilterParam << ", bandwidth=" << m_dDefaultFilterBandwidth \r
-      << ", inputScale=" << m_dDefaultFilterInputScale << ", outputScale=" << m_dDefaultFilterOutputScale;\r
-    *theApp->getLog() << os.str().c_str() << "\n";\r
-    wxString filename = "untitled.if";\r
-    ImageFileDocument* pFilterDoc = dynamic_cast<ImageFileDocument*>(theApp->getDocManager()->CreateDocument ("untitled.if", wxDOC_SILENT));\r
-    if (! pFilterDoc) {\r
-      sys_error (ERR_SEVERE, "Unable to create filter image");\r
-      return;\r
-    }\r
-    ImageFile& rIF = pFilterDoc->getImageFile();\r
-    rIF.setArraySize (m_iDefaultFilterXSize, m_iDefaultFilterYSize);\r
-    rIF.filterResponse (strDomain.c_str(), m_dDefaultFilterBandwidth, strFilter.c_str(), m_dDefaultFilterParam, m_dDefaultFilterInputScale, m_dDefaultFilterOutputScale);\r
-    rIF.labelAdd (os.str().c_str());\r
-    if (theApp->getSetModifyNewDocs())\r
-      pFilterDoc->Modify (true);\r
-    pFilterDoc->UpdateAllViews();\r
-    pFilterDoc->GetFirstView()->OnUpdate (NULL, NULL);\r
-  }\r
-}\r
-\r
-void\r
-CTSimApp::getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF)\r
-{\r
-  const ImageFile& rIF = pIFDoc->getImageFile();\r
-  unsigned int nx = rIF.nx();\r
-  unsigned int ny = rIF.ny();\r
-  wxList& rListDocs = m_docManager->GetDocuments();\r
-  for (wxNode* pNode = rListDocs.GetFirst(); pNode != NULL; pNode = pNode->GetNext()) {\r
-    wxDocument* pDoc = reinterpret_cast<wxDocument*>(pNode->GetData());\r
-    ImageFileDocument* pIFCompareDoc = dynamic_cast<ImageFileDocument*>(pDoc);\r
-    if (pIFCompareDoc && (pIFDoc != pIFCompareDoc)) {\r
-      const ImageFile& rCompareIF = pIFCompareDoc->getImageFile();\r
-      if (rCompareIF.nx() == nx && rCompareIF.ny() == ny)\r
-        vecIF.push_back (pIFCompareDoc);\r
-    }\r
-  }\r
-}\r
-\r
+
+void 
+MainFrame::OnCreatePhantom(wxCommandEvent& WXUNUSED(event))
+{
+  DialogGetPhantom dialogPhantom (this, m_iDefaultPhantomID);
+  int dialogReturn = dialogPhantom.ShowModal();
+  if (dialogReturn == wxID_OK) {
+    wxString selection (dialogPhantom.getPhantom());
+    *theApp->getLog() << "Selected phantom " << selection.c_str() << "\n";
+    wxString filename = selection + ".phm";
+    m_iDefaultPhantomID = Phantom::convertNameToPhantomID (selection.c_str());
+    theApp->getDocManager()->CreateDocument(filename, wxDOC_SILENT);
+  }
+  
+}
+
+void 
+MainFrame::OnCreateFilter (wxCommandEvent& WXUNUSED(event))
+{
+  DialogGetFilterParameters dialogFilter (this, m_iDefaultFilterXSize, m_iDefaultFilterYSize, m_iDefaultFilterID, m_dDefaultFilterParam, m_dDefaultFilterBandwidth, m_iDefaultFilterDomainID, m_dDefaultFilterInputScale, m_dDefaultFilterOutputScale);
+  int dialogReturn = dialogFilter.ShowModal();
+  if (dialogReturn == wxID_OK) {
+    wxString strFilter (dialogFilter.getFilterName());
+    wxString strDomain (dialogFilter.getDomainName());
+    m_iDefaultFilterID = SignalFilter::convertFilterNameToID (strFilter.c_str());
+    m_iDefaultFilterDomainID = SignalFilter::convertDomainNameToID (strDomain.c_str());
+    m_iDefaultFilterXSize = dialogFilter.getXSize();
+    m_iDefaultFilterYSize = dialogFilter.getYSize();
+    m_dDefaultFilterBandwidth = dialogFilter.getBandwidth();
+    m_dDefaultFilterParam= dialogFilter.getFilterParam();
+    m_dDefaultFilterInputScale = dialogFilter.getInputScale();
+    m_dDefaultFilterOutputScale = dialogFilter.getOutputScale();
+    std::ostringstream os;
+    os << "Generate Filter=" << strFilter.c_str() 
+      << ", size=(" << static_cast<int>(m_iDefaultFilterXSize) << "," << static_cast<int>(m_iDefaultFilterYSize) 
+      << "), domain=" << strDomain.c_str() << ", filterParam=" << m_dDefaultFilterParam << ", bandwidth=" << m_dDefaultFilterBandwidth 
+      << ", inputScale=" << m_dDefaultFilterInputScale << ", outputScale=" << m_dDefaultFilterOutputScale;
+    *theApp->getLog() << os.str().c_str() << "\n";
+    wxString filename = "untitled.if";
+    ImageFileDocument* pFilterDoc = dynamic_cast<ImageFileDocument*>(theApp->getDocManager()->CreateDocument ("untitled.if", wxDOC_SILENT));
+    if (! pFilterDoc) {
+      sys_error (ERR_SEVERE, "Unable to create filter image");
+      return;
+    }
+    ImageFile& rIF = pFilterDoc->getImageFile();
+    rIF.setArraySize (m_iDefaultFilterXSize, m_iDefaultFilterYSize);
+    rIF.filterResponse (strDomain.c_str(), m_dDefaultFilterBandwidth, strFilter.c_str(), m_dDefaultFilterParam, m_dDefaultFilterInputScale, m_dDefaultFilterOutputScale);
+    rIF.labelAdd (os.str().c_str());
+    if (theApp->getSetModifyNewDocs())
+      pFilterDoc->Modify (true);
+    pFilterDoc->UpdateAllViews();
+    pFilterDoc->GetFirstView()->OnUpdate (NULL, NULL);
+  }
+}
+
+void
+CTSimApp::getCompatibleImages (const ImageFileDocument* pIFDoc, std::vector<ImageFileDocument*>& vecIF)
+{
+  const ImageFile& rIF = pIFDoc->getImageFile();
+  unsigned int nx = rIF.nx();
+  unsigned int ny = rIF.ny();
+  wxList& rListDocs = m_docManager->GetDocuments();
+  for (wxNode* pNode = rListDocs.GetFirst(); pNode != NULL; pNode = pNode->GetNext()) {
+    wxDocument* pDoc = reinterpret_cast<wxDocument*>(pNode->GetData());
+    ImageFileDocument* pIFCompareDoc = dynamic_cast<ImageFileDocument*>(pDoc);
+    if (pIFCompareDoc && (pIFDoc != pIFCompareDoc)) {
+      const ImageFile& rCompareIF = pIFCompareDoc->getImageFile();
+      if (rCompareIF.nx() == nx && rCompareIF.ny() == ny)
+        vecIF.push_back (pIFCompareDoc);
+    }
+  }
+}
+
 void 
 MainFrame::OnHelpContents(wxCommandEvent& WXUNUSED(event) )
 {
index 480216206819ac9a4c6e691741b2f91577bdd8a4..f0ece54b3e4f02e042433e328f2ac468e2d964b0 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dialogs.cpp,v 1.23 2001/01/02 05:34:57 kevin Exp $
+**  $Id: dialogs.cpp,v 1.24 2001/01/02 16:02:13 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 "wx/sizer.h"
 #include "dialogs.h"
 #include "ctsim.h"
-#include "ct.h"\r
-//#include "ctsupport.h"\r
+#include "ct.h"
+//#include "ctsupport.h"
 //#include "scanner.h"
 //#include "phantom.h"
 //#include "filter.h"
 //#include "backprojectors.h"
-#include "docs.h"\r
-#include "views.h"\r
-#include "imagefile.h"\r
-
-#if defined(MSVC) || HAVE_SSTREAM\r
-#include <sstream>\r
-#else\r
-#include <sstream_subst>\r
-#endif\r
-\r
-
-///////////////////////////////////////////////////////////////////////\r
-// CLASS IMPLEMENTATION\r
-//    StringValueAndTitleListBox\r
-///////////////////////////////////////////////////////////////////////\r
-\r
+#include "docs.h"
+#include "views.h"
+#include "imagefile.h"
+
+#if defined(MSVC) || HAVE_SSTREAM
+#include <sstream>
+#else
+#include <sstream_subst>
+#endif
+
+
+///////////////////////////////////////////////////////////////////////
+// CLASS IMPLEMENTATION
+//    StringValueAndTitleListBox
+///////////////////////////////////////////////////////////////////////
+
 StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[])
 : wxListBox ()
 {
@@ -79,7 +79,7 @@ StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int n
   
   Create (pParent, -1, wxDefaultPosition, wxSize(200,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
   
-  m_ppszValues = aszValue;\r
+  m_ppszValues = aszValue;
   delete [] psTitle;
 };
 
@@ -90,10 +90,10 @@ StringValueAndTitleListBox::getSelectionStringValue (void) const
 }
 
 
-///////////////////////////////////////////////////////////////////////\r
-// CLASS IMPLEMENTATION\r
-//    DialogGetPhantom\r
-///////////////////////////////////////////////////////////////////////\r
+///////////////////////////////////////////////////////////////////////
+// CLASS IMPLEMENTATION
+//    DialogGetPhantom
+///////////////////////////////////////////////////////////////////////
 
 DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, int iDefaultPhantom)
 : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
@@ -130,77 +130,77 @@ DialogGetPhantom::getPhantom(void)
   return m_pListBoxPhantom->getSelectionStringValue();
 }
 
-\r
-///////////////////////////////////////////////////////////////////////\r
-// CLASS IMPLEMENTATION\r
-//    DialogGetComparisonImage\r
-///////////////////////////////////////////////////////////////////////\r
-\r
-DialogGetComparisonImage::DialogGetComparisonImage (wxFrame* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference)\r
-: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rVecIF(rVecIF)\r
-{\r
-  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);\r
-  \r
-  pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxALL, 5);\r
-  \r
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);\r
-  \r
-  int iNImages = m_rVecIF.size();\r
-  wxString* pstrImages = new wxString [iNImages];\r
-  for (int i = 0; i < iNImages; i++) {\r
-    ImageFileView* pView = dynamic_cast<ImageFileView*>(m_rVecIF[i]->GetFirstView());\r
-    if (pView)\r
-      pstrImages[i] = pView->getFrame()->GetTitle();\r
-  }\r
-\r
-  m_pListBoxImageChoices = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, iNImages, pstrImages, wxLB_SINGLE);\r
-  delete [] pstrImages;\r
-\r
-  m_pListBoxImageChoices->SetSelection (0);\r
-  pTopSizer->Add (m_pListBoxImageChoices, 0, wxALL | wxALIGN_CENTER | wxEXPAND);\r
-  \r
-  if (bShowMakeDifference) {\r
-    m_pMakeDifferenceImage = new wxCheckBox (this, -1, "Make Difference Image");\r
-    m_pMakeDifferenceImage->SetValue (FALSE);\r
-    pTopSizer->Add (m_pMakeDifferenceImage, 0, wxALL | wxALIGN_CENTER | wxEXPAND);\r
-  } else\r
-    m_pMakeDifferenceImage = NULL;\r
-\r
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);\r
-  \r
-  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);\r
-  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");\r
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");\r
-  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);\r
-  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);\r
-  \r
-  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);\r
-  \r
-  SetAutoLayout (true);\r
-  SetSizer (pTopSizer);\r
-  pTopSizer->Fit (this);\r
-  pTopSizer->SetSizeHints (this);\r
-}\r
-\r
-ImageFileDocument*\r
-DialogGetComparisonImage::getImageFileDocument(void)\r
-{\r
-  return m_rVecIF[ m_pListBoxImageChoices->GetSelection() ];\r
-}\r
-\r
-bool\r
-DialogGetComparisonImage::getMakeDifferenceImage()\r
-{\r
-  if (m_pMakeDifferenceImage)\r
-    return m_pMakeDifferenceImage->GetValue();\r
-  else\r
-    return false;\r
-}\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////\r
-// CLASS DiaglogGetMinMax Implementation\r
-/////////////////////////////////////////////////////////////////////\r
+
+///////////////////////////////////////////////////////////////////////
+// CLASS IMPLEMENTATION
+//    DialogGetComparisonImage
+///////////////////////////////////////////////////////////////////////
+
+DialogGetComparisonImage::DialogGetComparisonImage (wxFrame* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference)
+: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rVecIF(rVecIF)
+{
+  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+  
+  pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxALL, 5);
+  
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
+  
+  int iNImages = m_rVecIF.size();
+  wxString* pstrImages = new wxString [iNImages];
+  for (int i = 0; i < iNImages; i++) {
+    ImageFileView* pView = dynamic_cast<ImageFileView*>(m_rVecIF[i]->GetFirstView());
+    if (pView)
+      pstrImages[i] = pView->getFrame()->GetTitle();
+  }
+
+  m_pListBoxImageChoices = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, iNImages, pstrImages, wxLB_SINGLE);
+  delete [] pstrImages;
+
+  m_pListBoxImageChoices->SetSelection (0);
+  pTopSizer->Add (m_pListBoxImageChoices, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+  
+  if (bShowMakeDifference) {
+    m_pMakeDifferenceImage = new wxCheckBox (this, -1, "Make Difference Image");
+    m_pMakeDifferenceImage->SetValue (FALSE);
+    pTopSizer->Add (m_pMakeDifferenceImage, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+  } else
+    m_pMakeDifferenceImage = NULL;
+
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+  
+  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
+  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  
+  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  
+  SetAutoLayout (true);
+  SetSizer (pTopSizer);
+  pTopSizer->Fit (this);
+  pTopSizer->SetSizeHints (this);
+}
+
+ImageFileDocument*
+DialogGetComparisonImage::getImageFileDocument(void)
+{
+  return m_rVecIF[ m_pListBoxImageChoices->GetSelection() ];
+}
+
+bool
+DialogGetComparisonImage::getMakeDifferenceImage()
+{
+  if (m_pMakeDifferenceImage)
+    return m_pMakeDifferenceImage->GetValue();
+  else
+    return false;
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// CLASS DiaglogGetMinMax Implementation
+/////////////////////////////////////////////////////////////////////
 
 DialogGetMinMax::DialogGetMinMax (wxFrame* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
@@ -268,89 +268,89 @@ DialogGetMinMax::getMaximum (void)
 }
 
 
-/////////////////////////////////////////////////////////////////////\r
-// CLASS DialogAutoScaleParameters IMPLEMENTATION\r
-/////////////////////////////////////////////////////////////////////\r
-\r
-DialogAutoScaleParameters::DialogAutoScaleParameters (wxFrame *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)\r
-: wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)\r
-{\r
-  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);\r
-  \r
-  pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);\r
-  \r
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);\r
-  \r
-  wxString asTitle[3];\r
-  asTitle[0] = "Median";\r
-  asTitle[1] = "Mode";\r
-  asTitle[2] = "Mean";\r
-  \r
-  m_pListBoxCenter = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, 3, asTitle, wxLB_SINGLE | wxLB_NEEDED_SB);\r
-  m_pListBoxCenter->SetSelection (0);\r
-  pTopSizer->Add (m_pListBoxCenter, 0, wxALL | wxALIGN_CENTER | wxEXPAND);\r
-  \r
-  wxGridSizer *pGridSizer = new wxGridSizer (2);\r
-  pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);\r
-  std::ostringstream osDefaultFactor;\r
-  osDefaultFactor << dDefaultScaleFactor;\r
-  m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);\r
-  pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);\r
-  pTopSizer->Add (pGridSizer, 1, wxALL, 10);\r
-  \r
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);\r
-  \r
-  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);\r
-  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");\r
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");\r
-  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);\r
-  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);\r
-  \r
-  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);\r
-  \r
-  SetAutoLayout (true);\r
-  SetSizer (pTopSizer);\r
-  pTopSizer->Fit (this);\r
-  pTopSizer->SetSizeHints (this);\r
-}\r
-\r
-bool\r
-DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)\r
-{\r
-  int iCenter = m_pListBoxCenter->GetSelection();\r
-  double dCenter = m_dMedian;\r
-  if (iCenter == 1)\r
-    dCenter = m_dMode;\r
-  else if (iCenter == 2)\r
-    dCenter = m_dMode;\r
-  \r
-  wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();\r
-  double dValue;\r
-  if (! sStddevFactor.ToDouble (&dValue)) {\r
-    *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";\r
-    return false;\r
-  }\r
-  double dHalfWidth = dValue * m_dStdDev / 2;\r
-  *pMin = dCenter - dHalfWidth;\r
-  *pMax = dCenter + dHalfWidth;\r
-  *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";\r
-  \r
-  return true;\r
-}\r
-\r
-double\r
-DialogAutoScaleParameters::getAutoScaleFactor ()\r
-{\r
-  wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();\r
-  double dValue = 1.;\r
-  if (! sStddevFactor.ToDouble (&dValue)) {\r
-    *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";\r
-  }\r
-  \r
-  return dValue;\r
-}\r
-\r
-\r
+/////////////////////////////////////////////////////////////////////
+// CLASS DialogAutoScaleParameters IMPLEMENTATION
+/////////////////////////////////////////////////////////////////////
+
+DialogAutoScaleParameters::DialogAutoScaleParameters (wxFrame *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
+: wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
+{
+  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+  
+  pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
+  
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+  
+  wxString asTitle[3];
+  asTitle[0] = "Median";
+  asTitle[1] = "Mode";
+  asTitle[2] = "Mean";
+  
+  m_pListBoxCenter = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, 3, asTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
+  m_pListBoxCenter->SetSelection (0);
+  pTopSizer->Add (m_pListBoxCenter, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+  
+  wxGridSizer *pGridSizer = new wxGridSizer (2);
+  pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  std::ostringstream osDefaultFactor;
+  osDefaultFactor << dDefaultScaleFactor;
+  m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
+  pTopSizer->Add (pGridSizer, 1, wxALL, 10);
+  
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+  
+  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
+  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  
+  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  
+  SetAutoLayout (true);
+  SetSizer (pTopSizer);
+  pTopSizer->Fit (this);
+  pTopSizer->SetSizeHints (this);
+}
+
+bool
+DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
+{
+  int iCenter = m_pListBoxCenter->GetSelection();
+  double dCenter = m_dMedian;
+  if (iCenter == 1)
+    dCenter = m_dMode;
+  else if (iCenter == 2)
+    dCenter = m_dMode;
+  
+  wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
+  double dValue;
+  if (! sStddevFactor.ToDouble (&dValue)) {
+    *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
+    return false;
+  }
+  double dHalfWidth = dValue * m_dStdDev / 2;
+  *pMin = dCenter - dHalfWidth;
+  *pMax = dCenter + dHalfWidth;
+  *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
+  
+  return true;
+}
+
+double
+DialogAutoScaleParameters::getAutoScaleFactor ()
+{
+  wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
+  double dValue = 1.;
+  if (! sStddevFactor.ToDouble (&dValue)) {
+    *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
+  }
+  
+  return dValue;
+}
+
+
 /////////////////////////////////////////////////////////////////////
 // CLASS IDENTIFICATION
 //
@@ -662,7 +662,7 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* p
   m_pListBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
   pGridSizer->Add (new wxStaticText (this, -1, "Filter Generation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
   pGridSizer->Add (m_pListBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
-  \r
+  
   
   m_pListBoxBackproject = new StringValueAndTitleListBox (this, Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
   m_pListBoxBackproject->SetSelection (iDefaultBackprojectID);
@@ -675,14 +675,14 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* p
   pGridSizer->Add (m_pListBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
   
   
-  pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);\r
-  static const char* aszTraceTitle[] = {"None", "Full"};\r
-  static const char* aszTraceName[] = {"none", "full"};\r
-  m_pListBoxTrace = new StringValueAndTitleListBox (this, 2, aszTraceTitle, aszTraceName);\r
-  iTrace = clamp(iTrace, 0, 1);\r
-  m_pListBoxTrace->SetSelection (iTrace);\r
-  pGridSizer->Add (m_pListBoxTrace);\r
-  \r
+  pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  static const char* aszTraceTitle[] = {"None", "Full"};
+  static const char* aszTraceName[] = {"none", "full"};
+  m_pListBoxTrace = new StringValueAndTitleListBox (this, 2, aszTraceTitle, aszTraceName);
+  iTrace = clamp(iTrace, 0, 1);
+  m_pListBoxTrace->SetSelection (iTrace);
+  pGridSizer->Add (m_pListBoxTrace);
+  
   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
@@ -813,279 +813,279 @@ DialogGetReconstructionParameters::getFilterGenerationName (void)
   return m_pListBoxFilterGeneration->getSelectionStringValue();
 }
 
-\r
-/////////////////////////////////////////////////////////////////////\r
-// CLASS IDENTIFICATION\r
-//\r
-// DialogGetFilterParameters\r
-/////////////////////////////////////////////////////////////////////\r
-\r
-\r
-DialogGetFilterParameters::DialogGetFilterParameters (wxFrame* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam,  double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)\r
-: wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)\r
-{\r
-  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);\r
-  \r
-  pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);\r
-  \r
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);\r
-  \r
-  std::ostringstream os;\r
-  os << iDefaultXSize;\r
-  m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);\r
-  std::ostringstream osYSize;\r
-  osYSize << iDefaultYSize;\r
-  m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);\r
-  std::ostringstream osFilterParam;\r
-  osFilterParam << dDefaultFilterParam;\r
-  m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);\r
-  std::ostringstream osBandwidth;\r
-  osBandwidth << dDefaultBandwidth;\r
-  m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);\r
-  std::ostringstream osInputScale;\r
-  osInputScale << dDefaultInputScale;\r
-  m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);\r
-  std::ostringstream osOutputScale;\r
-  osOutputScale << dDefaultOutputScale;\r
-  m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);\r
-  \r
-  wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);\r
-  pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);\r
-  m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());\r
-  m_pListBoxFilter->SetSelection (iDefaultFilterID);\r
-  pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);\r
-  \r
-  m_pListBoxDomain = new StringValueAndTitleListBox (this, SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());\r
-  m_pListBoxDomain->SetSelection (iDefaultDomainID);\r
-  pGridSizer->Add (new wxStaticText (this, -1, "Domain"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);\r
-  pGridSizer->Add (m_pListBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);\r
-  \r
-  pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);\r
-  \r
-  pTopSizer->Add (pGridSizer, 1, wxALL, 3);\r
-  \r
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);\r
-  \r
-  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);\r
-  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");\r
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");\r
-  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);\r
-  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);\r
-  \r
-  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);\r
-  \r
-  SetAutoLayout (true);\r
-  SetSizer (pTopSizer);\r
-  pTopSizer->Layout();\r
-  pTopSizer->Fit (this);\r
-  pTopSizer->SetSizeHints (this);\r
-}\r
-\r
-DialogGetFilterParameters::~DialogGetFilterParameters (void)\r
-{\r
-}\r
-\r
-\r
-unsigned int\r
-DialogGetFilterParameters::getXSize (void)\r
-{\r
-  wxString strCtrl = m_pTextCtrlXSize->GetValue();\r
-  unsigned long lValue;\r
-  if (strCtrl.ToULong (&lValue))\r
-    return lValue;\r
-  else\r
-    return (m_iDefaultXSize);\r
-}\r
-\r
-unsigned int\r
-DialogGetFilterParameters::getYSize (void)\r
-{\r
-  wxString strCtrl = m_pTextCtrlYSize->GetValue();\r
-  unsigned long lValue;\r
-  if (strCtrl.ToULong (&lValue))\r
-    return lValue;\r
-  else\r
-    return (m_iDefaultYSize);\r
-}\r
-\r
-double\r
-DialogGetFilterParameters::getBandwidth (void)\r
-{\r
-  wxString strCtrl = m_pTextCtrlBandwidth->GetValue();\r
-  double dValue;\r
-  if (strCtrl.ToDouble (&dValue))\r
-    return dValue;\r
-  else\r
-    return (m_dDefaultBandwidth);\r
-}\r
-\r
-double\r
-DialogGetFilterParameters::getFilterParam (void)\r
-{\r
-  wxString strCtrl = m_pTextCtrlFilterParam->GetValue();\r
-  double dValue;\r
-  if (strCtrl.ToDouble (&dValue))\r
-    return (dValue);\r
-  else\r
-    return (m_dDefaultFilterParam);\r
-}\r
-\r
-double\r
-DialogGetFilterParameters::getInputScale (void)\r
-{\r
-  wxString strCtrl = m_pTextCtrlInputScale->GetValue();\r
-  double dValue;\r
-  if (strCtrl.ToDouble (&dValue))\r
-    return dValue;\r
-  else\r
-    return (m_dDefaultInputScale);\r
-}\r
-\r
-double\r
-DialogGetFilterParameters::getOutputScale (void)\r
-{\r
-  wxString strCtrl = m_pTextCtrlOutputScale->GetValue();\r
-  double dValue;\r
-  if (strCtrl.ToDouble (&dValue))\r
-    return dValue;\r
-  else\r
-    return (m_dDefaultOutputScale);\r
-}\r
-\r
-const char*\r
-DialogGetFilterParameters::getFilterName (void)\r
-{\r
-  return m_pListBoxFilter->getSelectionStringValue();\r
-}\r
-\r
-const char*\r
-DialogGetFilterParameters::getDomainName (void)\r
-{\r
-  return m_pListBoxDomain->getSelectionStringValue();\r
-}\r
-\r
-\r
-///////////////////////////////////////////////////////////////////////\r
-// CLASS IMPLEMENTATION\r
-//    DialogExportParameters\r
-///////////////////////////////////////////////////////////////////////\r
-\r
-DialogExportParameters::DialogExportParameters (wxFrame* pParent, int iDefaultFormatID)\r
-: wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)\r
-{\r
-  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);\r
-  \r
-  pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);\r
-  \r
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);\r
-  \r
-  m_pListBoxFormat = new StringValueAndTitleListBox (this, ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());\r
-  m_pListBoxFormat->SetSelection (iDefaultFormatID);\r
-  pTopSizer->Add (m_pListBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);\r
-  \r
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);\r
-  \r
-  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);\r
-  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");\r
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");\r
-  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);\r
-  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);\r
-  \r
-  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);\r
-  \r
-  SetAutoLayout (true);\r
-  SetSizer (pTopSizer);\r
-  pTopSizer->Fit (this);\r
-  pTopSizer->SetSizeHints (this);\r
-}\r
-\r
-const char*\r
-DialogExportParameters::getFormatName(void)\r
-{\r
-  return m_pListBoxFormat->getSelectionStringValue();\r
-}\r
-\r
-\r
-/////////////////////////////////////////////////////////////////////\r
-// CLASS DiaglogGetXYSize Implementation\r
-/////////////////////////////////////////////////////////////////////\r
-\r
-DialogGetXYSize::DialogGetXYSize (wxFrame* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)\r
-: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)\r
-{\r
-  m_iDefaultXSize = iDefaultXSize;\r
-  m_iDefaultYSize = iDefaultYSize;\r
-\r
-  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);\r
-  \r
-  pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);\r
-  \r
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);\r
-  \r
-  std::ostringstream os;\r
-  os << iDefaultXSize;\r
-  m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);\r
-  std::ostringstream osYSize;\r
-  osYSize << iDefaultYSize;\r
-  m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);\r
-  \r
-  wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);\r
-  pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);\r
-  pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);\r
-  pTopSizer->Add (pGridSizer, 1, wxALL, 10);\r
-  \r
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);\r
-  \r
-  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);\r
-  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");\r
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");\r
-  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);\r
-  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);\r
-  \r
-  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);\r
-  \r
-  SetAutoLayout (true);\r
-  SetSizer (pTopSizer);\r
-  pTopSizer->Fit (this);\r
-  pTopSizer->SetSizeHints (this);\r
-}\r
-\r
-DialogGetXYSize::~DialogGetXYSize (void)\r
-{\r
-}\r
-\r
-unsigned int\r
-DialogGetXYSize::getXSize (void)\r
-{\r
-  wxString strCtrl = m_pTextCtrlXSize->GetValue();\r
-  long lValue;\r
-  if (strCtrl.ToLong (&lValue))\r
-    return lValue;\r
-  else\r
-    return (m_iDefaultXSize);\r
-}\r
-\r
-unsigned int\r
-DialogGetXYSize::getYSize (void)\r
-{\r
-  wxString strCtrl = m_pTextCtrlYSize->GetValue();\r
-  long lValue;\r
-  if (strCtrl.ToLong (&lValue))\r
-    return lValue;\r
-  else\r
-    return (m_iDefaultYSize);\r
-}\r
-\r
+
+/////////////////////////////////////////////////////////////////////
+// CLASS IDENTIFICATION
+//
+// DialogGetFilterParameters
+/////////////////////////////////////////////////////////////////////
+
+
+DialogGetFilterParameters::DialogGetFilterParameters (wxFrame* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam,  double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
+: wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+{
+  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+  
+  pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
+  
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+  
+  std::ostringstream os;
+  os << iDefaultXSize;
+  m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  std::ostringstream osYSize;
+  osYSize << iDefaultYSize;
+  m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  std::ostringstream osFilterParam;
+  osFilterParam << dDefaultFilterParam;
+  m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  std::ostringstream osBandwidth;
+  osBandwidth << dDefaultBandwidth;
+  m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  std::ostringstream osInputScale;
+  osInputScale << dDefaultInputScale;
+  m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  std::ostringstream osOutputScale;
+  osOutputScale << dDefaultOutputScale;
+  m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  
+  wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
+  pGridSizer->Add (new wxStaticText (this, -1, "Filter"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
+  m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
+  m_pListBoxFilter->SetSelection (iDefaultFilterID);
+  pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
+  
+  m_pListBoxDomain = new StringValueAndTitleListBox (this, SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
+  m_pListBoxDomain->SetSelection (iDefaultDomainID);
+  pGridSizer->Add (new wxStaticText (this, -1, "Domain"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
+  pGridSizer->Add (m_pListBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
+  
+  pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+  
+  pTopSizer->Add (pGridSizer, 1, wxALL, 3);
+  
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+  
+  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
+  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  
+  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  
+  SetAutoLayout (true);
+  SetSizer (pTopSizer);
+  pTopSizer->Layout();
+  pTopSizer->Fit (this);
+  pTopSizer->SetSizeHints (this);
+}
+
+DialogGetFilterParameters::~DialogGetFilterParameters (void)
+{
+}
+
+
+unsigned int
+DialogGetFilterParameters::getXSize (void)
+{
+  wxString strCtrl = m_pTextCtrlXSize->GetValue();
+  unsigned long lValue;
+  if (strCtrl.ToULong (&lValue))
+    return lValue;
+  else
+    return (m_iDefaultXSize);
+}
+
+unsigned int
+DialogGetFilterParameters::getYSize (void)
+{
+  wxString strCtrl = m_pTextCtrlYSize->GetValue();
+  unsigned long lValue;
+  if (strCtrl.ToULong (&lValue))
+    return lValue;
+  else
+    return (m_iDefaultYSize);
+}
+
+double
+DialogGetFilterParameters::getBandwidth (void)
+{
+  wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
+  double dValue;
+  if (strCtrl.ToDouble (&dValue))
+    return dValue;
+  else
+    return (m_dDefaultBandwidth);
+}
+
+double
+DialogGetFilterParameters::getFilterParam (void)
+{
+  wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
+  double dValue;
+  if (strCtrl.ToDouble (&dValue))
+    return (dValue);
+  else
+    return (m_dDefaultFilterParam);
+}
+
+double
+DialogGetFilterParameters::getInputScale (void)
+{
+  wxString strCtrl = m_pTextCtrlInputScale->GetValue();
+  double dValue;
+  if (strCtrl.ToDouble (&dValue))
+    return dValue;
+  else
+    return (m_dDefaultInputScale);
+}
+
+double
+DialogGetFilterParameters::getOutputScale (void)
+{
+  wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
+  double dValue;
+  if (strCtrl.ToDouble (&dValue))
+    return dValue;
+  else
+    return (m_dDefaultOutputScale);
+}
+
+const char*
+DialogGetFilterParameters::getFilterName (void)
+{
+  return m_pListBoxFilter->getSelectionStringValue();
+}
+
+const char*
+DialogGetFilterParameters::getDomainName (void)
+{
+  return m_pListBoxDomain->getSelectionStringValue();
+}
+
+
+///////////////////////////////////////////////////////////////////////
+// CLASS IMPLEMENTATION
+//    DialogExportParameters
+///////////////////////////////////////////////////////////////////////
+
+DialogExportParameters::DialogExportParameters (wxFrame* pParent, int iDefaultFormatID)
+: wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+{
+  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+  
+  pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
+  
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
+  
+  m_pListBoxFormat = new StringValueAndTitleListBox (this, ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
+  m_pListBoxFormat->SetSelection (iDefaultFormatID);
+  pTopSizer->Add (m_pListBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+  
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+  
+  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
+  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  
+  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  
+  SetAutoLayout (true);
+  SetSizer (pTopSizer);
+  pTopSizer->Fit (this);
+  pTopSizer->SetSizeHints (this);
+}
+
+const char*
+DialogExportParameters::getFormatName(void)
+{
+  return m_pListBoxFormat->getSelectionStringValue();
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// CLASS DiaglogGetXYSize Implementation
+/////////////////////////////////////////////////////////////////////
+
+DialogGetXYSize::DialogGetXYSize (wxFrame* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
+: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+{
+  m_iDefaultXSize = iDefaultXSize;
+  m_iDefaultYSize = iDefaultYSize;
+
+  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+  
+  pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
+  
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+  
+  std::ostringstream os;
+  os << iDefaultXSize;
+  m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  std::ostringstream osYSize;
+  osYSize << iDefaultYSize;
+  m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  
+  wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
+  pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
+  pTopSizer->Add (pGridSizer, 1, wxALL, 10);
+  
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+  
+  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
+  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  
+  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  
+  SetAutoLayout (true);
+  SetSizer (pTopSizer);
+  pTopSizer->Fit (this);
+  pTopSizer->SetSizeHints (this);
+}
+
+DialogGetXYSize::~DialogGetXYSize (void)
+{
+}
+
+unsigned int
+DialogGetXYSize::getXSize (void)
+{
+  wxString strCtrl = m_pTextCtrlXSize->GetValue();
+  long lValue;
+  if (strCtrl.ToLong (&lValue))
+    return lValue;
+  else
+    return (m_iDefaultXSize);
+}
+
+unsigned int
+DialogGetXYSize::getYSize (void)
+{
+  wxString strCtrl = m_pTextCtrlYSize->GetValue();
+  long lValue;
+  if (strCtrl.ToLong (&lValue))
+    return lValue;
+  else
+    return (m_iDefaultYSize);
+}
+
index 489d912b99097fb16eaddef99bac7057f52b3dfb..fb2f8cdf9835d221e3eb5d8369b8c198c62c520c 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dlgprojections.cpp,v 1.14 2000/12/29 15:45:06 kevin Exp $
+**  $Id: dlgprojections.cpp,v 1.15 2001/01/02 16:02:13 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
@@ -126,7 +126,7 @@ ProjectionsDialog::ProjectionsDialog (Scanner& rScanner, Projections& rProj, con
     Show(TRUE);
     Enable(TRUE); // enable this window
        
-    m_bitmap.Create (m_iClientX, m_iClientY); // save a copy of screen\r
+    m_bitmap.Create (m_iClientX, m_iClientY); // save a copy of screen
     m_pDC = dynamic_cast<wxDC*> (new wxClientDC (this));
     int x, y;
     this->GetClientSize(&x, &y);
@@ -145,8 +145,8 @@ void
 ProjectionsDialog::showView (int iViewNumber)
 {
     if ( iViewNumber < m_rProjections.nView() ) {
-               m_iLastView = iViewNumber;\r
-               ::wxYield();        // update the display\r
+               m_iLastView = iViewNumber;
+               ::wxYield();        // update the display
                m_pSGP->eraseWindow();
                m_btnPause->Refresh();
                m_btnStep->Refresh();
@@ -154,7 +154,7 @@ ProjectionsDialog::showView (int iViewNumber)
 
                if (m_iTrace >= Trace::TRACE_PLOT)
                        m_pSGP->setViewport (0, 0, 0.66, 1);
-               ::wxYield();        // update the display\r
+               ::wxYield();        // update the display
                m_rScanner.collectProjections (m_rProjections, m_rPhantom, iViewNumber, 1, true, m_iTrace, m_pSGP);
                ::wxYield();        // update the display
                if (m_iTrace >= Trace::TRACE_PLOT) {
@@ -165,11 +165,11 @@ ProjectionsDialog::showView (int iViewNumber)
                                detPos[i] = i;
                        EZPlot ezplot;
                        ezplot.ezset ("grid");
-                       ezplot.ezset ("box");\r
+                       ezplot.ezset ("box");
                        ezplot.ezset ("yticks left");
-                       ezplot.addCurve (detValues, detPos, detArray.nDet());\r
+                       ezplot.addCurve (detValues, detPos, detArray.nDet());
                        m_pSGP->setViewport (0.67, 0.1, 1., 1.);
-                       ezplot.plot (m_pSGP);\r
+                       ezplot.plot (m_pSGP);
                        delete detPos;
                }
     }
@@ -232,8 +232,8 @@ ProjectionsDialog::OnPause (wxCommandEvent& event)
                showView (m_iLastView);
                m_state = Paused;
                m_btnPause->SetLabel (wxString("Resume"));
-               m_pSGP->setDC (m_pDC);\r
-               m_memoryDC.SelectObject(wxNullBitmap);\r
+               m_pSGP->setDC (m_pDC);
+               m_memoryDC.SelectObject(wxNullBitmap);
        } else if (m_state == Paused) {
                m_state = Continue;
                m_btnPause->SetLabel (wxString("Pause"));
@@ -248,22 +248,22 @@ ProjectionsDialog::OnStep (wxCommandEvent& event)
        } else if (m_state == Continue) {
                m_memoryDC.SelectObject (m_bitmap);       // in memoryDC
                m_pSGP->setDC (&m_memoryDC);
-               m_memoryDC.SetFont (*wxSWISS_FONT);\r
+               m_memoryDC.SetFont (*wxSWISS_FONT);
                showView (m_iLastView);
                // m_rScanner.collectProjections (m_rProjections, m_rPhantom, m_iLastView, 1, true, m_iTrace, m_pSGP);
                m_state = Paused;
                m_btnPause->SetLabel (wxString("Resume"));
-               m_pSGP->setDC (m_pDC);\r
-               m_memoryDC.SelectObject(wxNullBitmap);\r
-               Refresh();\r
+               m_pSGP->setDC (m_pDC);
+               m_memoryDC.SelectObject(wxNullBitmap);
+               Refresh();
        } else if (m_state == Paused) {
-               m_memoryDC.SelectObject (m_bitmap);       // in memoryDC\r
-               m_pSGP->setDC (&m_memoryDC);\r
-               m_memoryDC.SetFont (*wxSWISS_FONT);\r
+               m_memoryDC.SelectObject (m_bitmap);       // in memoryDC
+               m_pSGP->setDC (&m_memoryDC);
+               m_memoryDC.SetFont (*wxSWISS_FONT);
                projectView (m_iLastView + 1);
-               m_pSGP->setDC (m_pDC);\r
-               m_memoryDC.SelectObject(wxNullBitmap);\r
-               Refresh();\r
+               m_pSGP->setDC (m_pDC);
+               m_memoryDC.SelectObject(wxNullBitmap);
+               Refresh();
        }
 }
 
@@ -280,7 +280,7 @@ void ProjectionsDialog::OnClose(wxCloseEvent& event)
 void
 ProjectionsDialog::OnPaint (wxPaintEvent& event)
 {
-       wxPaintDC paintDC (this);\r
+       wxPaintDC paintDC (this);
        if (m_state == Paused) {
                paintDC.DrawBitmap (m_bitmap, 0, 0, false);
        }
index 3dcd74a11065501eb2ee59716bb9e6daab837b4e..4fd7b1af7e8bc971c1433520aee74a0418cd6dbd 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dlgreconstruct.cpp,v 1.12 2000/12/18 12:29:41 kevin Exp $
+**  $Id: dlgreconstruct.cpp,v 1.13 2001/01/02 16:02:13 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
 
 static const int LAYOUT_X_MARGIN = 4;
 static const int LAYOUT_Y_MARGIN = 4;
-\r
-\r
-const int ReconstructDialog::ID_BTN_PAUSE = 19998;\r
-const int ReconstructDialog::ID_BTN_STEP = 19999;\r
-const int ReconstructDialog::MAX_IMAGE_X = 400;\r
-const int ReconstructDialog::MAX_IMAGE_Y = 400;\r
-\r
+
+
+const int ReconstructDialog::ID_BTN_PAUSE = 19998;
+const int ReconstructDialog::ID_BTN_STEP = 19999;
+const int ReconstructDialog::MAX_IMAGE_X = 400;
+const int ReconstructDialog::MAX_IMAGE_Y = 400;
+
 
 BEGIN_EVENT_TABLE(ReconstructDialog, wxDialog)
 EVT_BUTTON(wxID_CANCEL, ReconstructDialog::OnCancel)
@@ -130,20 +130,20 @@ ReconstructDialog::ReconstructDialog (Reconstructor& rReconstruct, const Project
     m_iClientY = sizeDlg.y;
     SetClientSize (sizeDlg);
        
-    Centre(wxCENTER_FRAME | wxBOTH);\r
-       \r
-    if ( m_parentTop )\r
-               m_parentTop->Enable(FALSE);\r
-       \r
-    Show(TRUE);\r
-    Enable(TRUE); // enable this window\r
-       \r
+    Centre(wxCENTER_FRAME | wxBOTH);
+       
+    if ( m_parentTop )
+               m_parentTop->Enable(FALSE);
+       
+    Show(TRUE);
+    Enable(TRUE); // enable this window
+       
     m_bitmap.Create (m_iClientX, m_iClientY); // save a copy of screen
-    m_pDC = dynamic_cast<wxDC*> (new wxClientDC (this));\r
-    int x, y;\r
-    this->GetClientSize(&x, &y);\r
-    m_pSGPDriver = new SGPDriver (m_pDC, x, y);\r
-    m_pSGP = new SGP (*m_pSGPDriver);\r
+    m_pDC = dynamic_cast<wxDC*> (new wxClientDC (this));
+    int x, y;
+    this->GetClientSize(&x, &y);
+    m_pSGPDriver = new SGPDriver (m_pDC, x, y);
+    m_pSGP = new SGP (*m_pSGPDriver);
        
     wxYield();     // Update the display
        
@@ -152,11 +152,11 @@ ReconstructDialog::ReconstructDialog (Reconstructor& rReconstruct, const Project
 
 void
 ReconstructDialog::showView (int iViewNumber, bool bBackprojectView)
-{\r
+{
        if ( iViewNumber < m_rProjections.nView() ) {
                m_iLastView = iViewNumber;
-               ::wxYield();        // update the display\r
-               m_pSGP->eraseWindow();\r
+               ::wxYield();        // update the display
+               m_pSGP->eraseWindow();
                m_btnPause->Refresh();
                m_btnStep->Refresh();
                m_btnAbort->Refresh();
@@ -202,7 +202,7 @@ ReconstructDialog::showView (int iViewNumber, bool bBackprojectView)
                                int baseAddr = ((m_nyImage - 1 - iy) * m_nxImage + ix2) * 3;
                                imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity;
                        }
-               }\r
+               }
                wxImage image (m_nxImage, m_nyImage, imageData, true);
                wxBitmap bitmap = image.ConvertToBitmap();
                m_pSGP->getDriver().idWX()->DrawBitmap(bitmap, xBase, yBase, false);
@@ -259,15 +259,15 @@ ReconstructDialog::OnPause (wxCommandEvent& event)
                // this means that the count down is already finished and we're being
                // shown as a modal dialog - so just let the default handler do the job
                event.Skip();
-       } else if (m_state == Continue) {\r
-               m_memoryDC.SelectObject (m_bitmap);       // in memoryDC\r
-               m_pSGP->setDC (&m_memoryDC);\r
-               m_memoryDC.SetFont (*wxSWISS_FONT);\r
-               showView (m_iLastView, false);\r
+       } else if (m_state == Continue) {
+               m_memoryDC.SelectObject (m_bitmap);       // in memoryDC
+               m_pSGP->setDC (&m_memoryDC);
+               m_memoryDC.SetFont (*wxSWISS_FONT);
+               showView (m_iLastView, false);
                m_state = Paused;
                m_btnPause->SetLabel (wxString("Resume"));
-               m_pSGP->setDC (m_pDC);\r
-               m_memoryDC.SelectObject(wxNullBitmap);\r
+               m_pSGP->setDC (m_pDC);
+               m_memoryDC.SelectObject(wxNullBitmap);
        } else if (m_state == Paused) {
                m_state = Continue;
                m_btnPause->SetLabel (wxString("Pause"));
@@ -280,24 +280,24 @@ ReconstructDialog::OnStep (wxCommandEvent& event)
 {
        if ( m_state == Finished ) {
                event.Skip();
-       } else if (m_state == Continue) {\r
-               m_memoryDC.SelectObject (m_bitmap);       // in memoryDC\r
-               m_pSGP->setDC (&m_memoryDC);\r
-               m_memoryDC.SetFont (*wxSWISS_FONT);\r
-               showView (m_iLastView, false);\r
+       } else if (m_state == Continue) {
+               m_memoryDC.SelectObject (m_bitmap);       // in memoryDC
+               m_pSGP->setDC (&m_memoryDC);
+               m_memoryDC.SetFont (*wxSWISS_FONT);
+               showView (m_iLastView, false);
                m_state = Paused;
                m_btnPause->SetLabel (wxString("Resume"));
-               m_pSGP->setDC (m_pDC);\r
-               m_memoryDC.SelectObject(wxNullBitmap);\r
-               Refresh();\r
+               m_pSGP->setDC (m_pDC);
+               m_memoryDC.SelectObject(wxNullBitmap);
+               Refresh();
        } else if (m_state == Paused) {
-               m_memoryDC.SelectObject (m_bitmap);       // in memoryDC\r
-               m_pSGP->setDC (&m_memoryDC);\r
-               m_memoryDC.SetFont (*wxSWISS_FONT);\r
+               m_memoryDC.SelectObject (m_bitmap);       // in memoryDC
+               m_pSGP->setDC (&m_memoryDC);
+               m_memoryDC.SetFont (*wxSWISS_FONT);
                reconstructView (m_iLastView + 1);
-               m_pSGP->setDC (m_pDC);\r
-               m_memoryDC.SelectObject(wxNullBitmap);\r
-               Refresh();\r
+               m_pSGP->setDC (m_pDC);
+               m_memoryDC.SelectObject(wxNullBitmap);
+               Refresh();
        }
 }
 
@@ -313,11 +313,11 @@ void ReconstructDialog::OnClose(wxCloseEvent& event)
 
 void
 ReconstructDialog::OnPaint (wxPaintEvent& event)
-{\r
-       wxPaintDC paintDC (this);\r
+{
+       wxPaintDC paintDC (this);
        if (m_state == Paused) {
-               paintDC.DrawBitmap (m_bitmap, 0, 0, false);\r
-       }\r
+               paintDC.DrawBitmap (m_bitmap, 0, 0, false);
+       }
 }
 
 
index 69b59544fc448f6afafff26201f94d69f5248170..d9b3d1098169533deb28d032598663bbc3912854 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: docs.cpp,v 1.10 2001/01/02 05:34:57 kevin Exp $
+**  $Id: docs.cpp,v 1.11 2001/01/02 16:02:13 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
@@ -80,8 +80,8 @@ bool ImageFileDocument::OnOpenDocument(const wxString& filename)
     SetFilename(filename, true);
   }
   Modify(false);
-  UpdateAllViews();\r
-  GetFirstView()->OnUpdate (GetFirstView(), NULL);\r
+  UpdateAllViews();
+  GetFirstView()->OnUpdate (GetFirstView(), NULL);
 
   return true;
 }
@@ -131,7 +131,7 @@ bool ProjectionFileDocument::OnOpenDocument(const wxString& filename)
     SetFilename(filename, true);
   }
   Modify(false);
-  UpdateAllViews();\r
+  UpdateAllViews();
 
   return true;
 }
@@ -175,22 +175,22 @@ bool PhantomDocument::OnOpenDocument(const wxString& filename)
   }
   m_idPhantom = m_phantom.id();
   Modify(false);
-  UpdateAllViews();\r
+  UpdateAllViews();
 
   return true;
 }
 
-bool PhantomDocument::OnSaveDocument(const wxString& filename)\r
-{\r
-  if (! m_phantom.fileWrite (filename.c_str())) {\r
-    *theApp->getLog() << "Unable to write phantom file " << filename << "\n";\r
-    return false;\r
-  }\r
-  *theApp->getLog() << "Wrote phantom file " << filename << "\n";\r
-  Modify(false);\r
-  return true;\r
-}\r
-\r
+bool PhantomDocument::OnSaveDocument(const wxString& filename)
+{
+  if (! m_phantom.fileWrite (filename.c_str())) {
+    *theApp->getLog() << "Unable to write phantom file " << filename << "\n";
+    return false;
+  }
+  *theApp->getLog() << "Wrote phantom file " << filename << "\n";
+  Modify(false);
+  return true;
+}
+
 bool PhantomDocument::OnCloseDocument ()
 {
   bool bReturn = wxDocument::OnCloseDocument();
@@ -212,18 +212,18 @@ void PhantomDocument::Modify(bool mod)
 
 IMPLEMENT_DYNAMIC_CLASS(PlotFileDocument, wxDocument)
 
-bool PlotFileDocument::OnSaveDocument(const wxString& filename)\r
-{\r
-  m_namePlot = filename.c_str();\r
-  if (! m_plot.fileWrite (filename)) {\r
-    *theApp->getLog() << "Unable to write plot file " << filename << "\n";\r
-    return false;\r
-  }\r
-  *theApp->getLog() << "Wrote plot file " << filename << "\n";\r
-  Modify(false);\r
-  return true;\r
-}\r
-\r
+bool PlotFileDocument::OnSaveDocument(const wxString& filename)
+{
+  m_namePlot = filename.c_str();
+  if (! m_plot.fileWrite (filename)) {
+    *theApp->getLog() << "Unable to write plot file " << filename << "\n";
+    return false;
+  }
+  *theApp->getLog() << "Wrote plot file " << filename << "\n";
+  Modify(false);
+  return true;
+}
+
 bool PlotFileDocument::OnOpenDocument(const wxString& filename)
 {
   if (filename == "untitled.plt") {
@@ -235,12 +235,12 @@ bool PlotFileDocument::OnOpenDocument(const wxString& filename)
       return false;
     }
     *theApp->getLog() << "Read plot file " << filename << "\n";
-    SetFilename (filename, true);\r
+    SetFilename (filename, true);
     m_namePlot = filename.c_str();
   }
   Modify (false);
-  UpdateAllViews();\r
-  GetFirstView()->OnUpdate (NULL, NULL);\r
+  UpdateAllViews();
+  GetFirstView()->OnUpdate (NULL, NULL);
 
   return true;
 }