r259: MSVC modifications
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 16 Dec 2000 03:29:02 +0000 (03:29 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 16 Dec 2000 03:29:02 +0000 (03:29 +0000)
14 files changed:
include/array2dfile.h
include/ctsupport.h
include/imagefile.h
include/projections.h
include/scanner.h
include/timer.h
src/ctsim.cpp
src/ctsim.h
src/dialogs.cpp
src/dlgprojections.cpp
src/dlgprojections.h
src/dlgreconstruct.cpp
src/dlgreconstruct.h
src/views.cpp

index 1a0d838ee69ec5811043cf941f06c104e7dfbd40..e5276e793f9a1f6ef2b6a5b5efe9286ec7368030 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: array2dfile.h,v 1.10 2000/12/16 02:44:26 kevin Exp $
+**  $Id: array2dfile.h,v 1.11 2000/12/16 03:29:02 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
@@ -182,7 +182,7 @@ public:
   const string& getFilename (void) const 
       {  return m_filename; }
 
-  void printLabels (ostream& os) const;
+  void printLabels (std::ostream& os) const;
 
   typedef vector<Array2dFileLabel*>::iterator labelIterator;
   typedef vector<Array2dFileLabel*>::const_iterator constLabelIterator;
index 6263b69bd88228019a0e5f930d3ec66dc930aa46..617554362cfffb3e78f9b65d7f7430a9cc3a988a 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsupport.h,v 1.11 2000/12/16 02:44:26 kevin Exp $
+**  $Id: ctsupport.h,v 1.12 2000/12/16 03:29:02 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -48,9 +48,6 @@
 #define TRUE   1
 #define FALSE  0
 #define OK     TRUE
-#define ERROR  FALSE
-#define YES    TRUE
-#define NO     FALSE
 
 /*----------------------------------------------------------------------*/
 
 
 /*----------------------------------------------------------------------*/
 
-struct time_st {
-       int hour, minute, second, ms;
-};
-
-struct date_st {
-       int year, month, date, dow;
-};
-
-struct timedate_st {
-    struct time_st t;
-    struct date_st d;
-};
-
-typedef struct time_st TIME;
-typedef struct date_st DATE;
-typedef struct timedate_st TIMEDATE;
-
-/*----------------------------------------------------------------------*/
-
 #define ERR_WARNING    0
 #define ERR_SEVERE     1
 #define ERR_FATAL      2
@@ -170,25 +148,6 @@ void sys_error(int severity, const char *msg, ...);
 void sys_verror(int severity, const char *msg, va_list arg);
 void sys_error_level(int severity);
 
-/* timedate.cpp */
-DATE *td_get_date(DATE *d);
-TIME *td_get_time(TIME *t);
-double td_current_sec(void);
-double td_time_to_sec(TIME *t);
-TIME *td_time_sub(const TIME *t1, const TIME *t2, TIME *tdiff);
-TIME *td_time_add(const TIME *t1, const TIME *t2, TIME *tsum);
-TIME *td_time_copy(TIME *to, const TIME *from);
-TIME *td_time_norm(TIME *t);
-void td_get_tmdt(TIMEDATE *td);
-const char *td_str_tmdt(const TIMEDATE *td);
-const char *td_str_time(const TIME *t);
-const char *td_str_stime(const TIME *t);
-const char *td_str_date(const DATE *d);
-char *td_str_cdate(DATE *d);
-char *td_month_name(int n);
-char *td_day_name(int n);
-
-
 // Math Section
 
 #include <cmath>
index ae090e78e713eff199121e4f77c0dc09278bf74c..dd0c0c9d5744e3a2c64b5a849a520f832b905175 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: imagefile.h,v 1.20 2000/12/04 05:36:57 kevin Exp $
+**  $Id: imagefile.h,v 1.21 2000/12/16 03:29:02 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,11 +123,11 @@ class ImageFile : public ImageFileBase
 
   void getMinMax (double& min, double& max) const;
 
-  void printStatistics (ostream& os) const;
+  void printStatistics (std::ostream& os) const;
 
   bool comparativeStatistics (const ImageFile& imComp, double& d, double& r, double& e) const;
 
-  bool printComparativeStatistics (const ImageFile& imComp, ostream& os) const;
+  bool printComparativeStatistics (const ImageFile& imComp, std::ostream& os) const;
 
   int display (void) const;
 
index 03cb2da92db5ba71d586b9bcb793eaae3bf04caa..eb1c3c7d03b852b4e2085eb976ab259b31e1ba8b 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: projections.h,v 1.16 2000/12/16 02:31:00 kevin Exp $
+**  $Id: projections.h,v 1.17 2000/12/16 03:29:02 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -89,11 +89,11 @@ class Projections
   const DetectorArray& getDetectorArray (const int iview) const
       { return (*m_projData[iview]); }
 
-  static bool copyHeader (const char* const filename, ostream& os);
-  static bool copyHeader (const string& filename, ostream& os);
+  static bool copyHeader (const char* const filename, std::ostream& os);
+  static bool copyHeader (const string& filename, std::ostream& os);
 
-  static bool copyViewData (const char* const filename, ostream& os, int startView, int endView);
-  static bool copyViewData (const string& filename, ostream& os, int startView, int endView);
+  static bool copyViewData (const char* const filename, std::ostream& os, int startView, int endView);
+  static bool copyViewData (const string& filename, std::ostream& os, int startView, int endView);
   
  private:
   int m_headerSize;            // Size of disk file header 
index 8911976f77366f32db7554c8c2e943838a878f1d..f0b498b72844e5d90ed223f243455b884d0cb985 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: scanner.h,v 1.15 2000/09/02 05:10:39 kevin Exp $
+**  $Id: scanner.h,v 1.16 2000/12/16 03:29:02 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -84,7 +84,7 @@ class Scanner
   void setNView (int nView);
 
   bool fail() const {return m_fail;}
-  const string& failMessage() const {return m_failMessage;}
+  const std::string& failMessage() const {return m_failMessage;}
   unsigned int nDet() const {return m_nDet;}
   unsigned int nView() const {return m_nView;}
   double phmLen() const {return m_phmLen;}
@@ -104,7 +104,7 @@ class Scanner
   
  private:
   bool m_fail;
-  string m_failMessage;
+  std::string m_failMessage;
   int m_idGeometry;
   unsigned int m_nDet;         /* Number of detectors in array */
   unsigned int m_nView;                /* Number of rotated views */
index 78b19e907358e73b768aebb05093ac4ac0b504fe..d0b5d7f508466219ea690dd618d90e8f9a409440 100644 (file)
@@ -25,7 +25,7 @@ class Timer
 
     virtual void timerReport (const char* const msg) const
       {
-         cout << msg << ": " << m_timeElapsed << " seconds" << endl;
+               std::cout << msg << ": " << m_timeElapsed << " seconds" << std::endl;
       }
 
     virtual double timerEndAndReport (const char* const msg)
@@ -85,7 +85,7 @@ class TimerMPI : public Timer
     virtual void timerReport (const char* const msg)
       {
          if (m_comm.Get_rank() == 0)
-             cout << msg << ": " << m_timeElapsed << " seconds" << endl;
+                 std::cout << msg << ": " << m_timeElapsed << " seconds" << std::endl;
       }
 
     virtual double timerEndAndReport (const char* const msg)
@@ -137,12 +137,12 @@ class TimerCollectiveMPI : public TimerMPI
     virtual void timerReport (const char* const msg)
       {
        if (m_comm.Get_rank() == 0)
-         cout << msg << " " << "Minimum=" << m_timeMin << ", Maximum=" << m_timeMax << " seconds" << endl;
+               std::cout << msg << " " << "Minimum=" << m_timeMin << ", Maximum=" << m_timeMax << " seconds" << std::endl;
       }
 
     virtual void timerReportAllProcesses (const char* const msg)
       {
-         cout << msg << ": " << "Minimum=" << m_timeMin << ", Maximum=" << m_timeMax << " seconds (Rank " << m_comm.Get_rank() << ")" << endl;
+               std::cout << msg << ": " << "Minimum=" << m_timeMin << ", Maximum=" << m_timeMax << " seconds (Rank " << m_comm.Get_rank() << ")" << std::endl;
       }
 
  private:
index 2d094d383e52e6e1198f82d9e204648f0e67a1bb..93a0a7100e5c6034f1a3a7fc855021ac4a305209 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsim.cpp,v 1.13 2000/09/07 14:29:05 kevin Exp $
+**  $Id: ctsim.cpp,v 1.14 2000/12/16 03:29:02 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 "config.h"
 #endif
 #if defined(HAVE_GETOPT_H) || defined(HAVE_GETOPT_LONG)
-#include <getopt.h>
+#include "getopt.h"
 #endif
 
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.13 2000/09/07 14:29:05 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.14 2000/12/16 03:29:02 kevin Exp $";
 
 class CTSimApp* theApp = NULL;
 
@@ -95,7 +95,7 @@ CTSimApp::OnInit()
 
       switch (c) {
       case O_VERSION:
-         cout << rcsindent << endl;
+                 std::cout << rcsindent << std::endl;
          exit(0);
       case O_HELP:
       case '?':
@@ -134,11 +134,11 @@ CTSimApp::OnInit()
 void
 CTSimApp::usage(const char* program)
 {
-    cout << "usage: " << fileBasename(program) << " [files-to-open...] [OPTIONS]\n";
-    cout << "Computed Tomography Simulator (Graphical Shell)\n";
-    cout << "\n";
-    cout << "  --version Display version\n";
-    cout << "  --help    Display this help message\n";
+       std::cout << "usage: " << fileBasename(program) << " [files-to-open...] [OPTIONS]\n";
+       std::cout << "Computed Tomography Simulator (Graphical Shell)\n";
+       std::cout << "\n";
+       std::cout << "  --version Display version\n";
+       std::cout << "  --help    Display this help message\n";
 }
 
 int
index 8367f21a9056b263c311f1c13a50e664241d71a8..62d97c28a7c22ca5a822d9b36ce63d382d466d0a 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsim.h,v 1.6 2000/09/07 01:28:33 kevin Exp $
+**  $Id: ctsim.h,v 1.7 2000/12/16 03:29:02 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
@@ -47,7 +47,7 @@ private:
     wxTextCtrl* m_pLog;
     wxMenu* m_pWindowMenu;
 
-    static const int MAX_WINDOW_MENUITEMS = 20;
+    enum { MAX_WINDOW_MENUITEMS = 20 };
     wxMenuItem* m_apWindowMenuItems[MAX_WINDOW_MENUITEMS];
     wxDocument* m_apWindowMenuData[MAX_WINDOW_MENUITEMS];
 
index ce808b4c92cb467f3a22e5b77a90fb79681b57a0..87542a9e64e6f8208f90e77b388210e12dac7614 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dialogs.cpp,v 1.13 2000/09/04 09:06:46 kevin Exp $
+**  $Id: dialogs.cpp,v 1.14 2000/12/16 03:29:02 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
 StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[])
   : wxListBox ()
 {
-    wxString asTitle[nChoices];
+    wxString* psTitle = new wxString [nChoices];
     for (int i = 0; i < nChoices; i++)
-       asTitle[i] = aszTitle[i];
+       psTitle[i] = aszTitle[i];
 
-    Create (pParent, -1, wxDefaultPosition, wxSize(200,-1), nChoices, asTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
+    Create (pParent, -1, wxDefaultPosition, wxSize(200,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
 
-    m_ppszValues = aszValue;
+    m_ppszValues = aszValue;\r
+       delete [] psTitle;
 };
 
 const char*
@@ -76,7 +77,7 @@ StringValueAndTitleListBox::getSelectionStringValue (void) const
 
 
 
-DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, int iDefaultPhantom = Phantom::PHM_HERMAN)
+DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, int iDefaultPhantom)
     : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
@@ -112,7 +113,7 @@ DialogGetPhantom::getPhantom(void)
 }
 
 
-DialogGetImageMinMax::DialogGetImageMinMax (wxFrame* pParent, const ImageFile& rImagefile, double dDefaultMin = 0., double dDefaultMax = 0.)
+DialogGetImageMinMax::DialogGetImageMinMax (wxFrame* pParent, const ImageFile& rImagefile, double dDefaultMin, double dDefaultMax)
     : wxDialog (pParent, -1, "Set Image Display Minimum & Maximum", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
@@ -188,7 +189,7 @@ DialogGetImageMinMax::getMaximum (void)
 // DialogGetRasterParameters
 /////////////////////////////////////////////////////////////////////
 
-DialogGetRasterParameters::DialogGetRasterParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultNSamples = 1)
+DialogGetRasterParameters::DialogGetRasterParameters (wxFrame* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples)
     : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
index 702befa5cfb6cfb2bc6e7a847e8ef72ee7e978c5..de6d0e634fbb7ef7e0179fa9ea9ca614654e5cee 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dlgprojections.cpp,v 1.6 2000/09/07 14:29:05 kevin Exp $
+**  $Id: dlgprojections.cpp,v 1.7 2000/12/16 03:29:02 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
@@ -155,7 +155,7 @@ ProjectionsDialog::showView (int iViewNumber)
        if (m_iTrace >= Trace::TRACE_PLOT) {
            const DetectorArray& detArray = m_rProjections.getDetectorArray (iViewNumber);
            const DetectorValue* detValues = detArray.detValues();
-           double detPos [detArray.nDet()];
+           double* detPos = new double [detArray.nDet()];
            for (int i = 0; i < detArray.nDet(); i++)
                detPos[i] = i;
            EZPlot ezplot (*m_pSGP);
@@ -166,7 +166,8 @@ ProjectionsDialog::showView (int iViewNumber)
            ezplot.ezset("grid");
            ezplot.ezset("box");
            ezplot.addCurve (detValues, detPos, detArray.nDet());
-           ezplot.plot();
+           ezplot.plot();\r
+               delete detPos;
        }
     }
 }
index d39260a0fbb4040f32f0ce0c56c5bfac22063076..203893775f7eb5390e5b1d547542a9261dca7a69 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dlgprojections.h,v 1.3 2000/09/02 16:40:36 kevin Exp $
+**  $Id: dlgprojections.h,v 1.4 2000/12/16 03:29:02 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
@@ -111,8 +111,7 @@ private:
       Finished             // finished, waiting to be removed from screen
    } m_state;
 
-   const static int ID_BTN_PAUSE = 19996;
-   const static int ID_BTN_STEP = 19997;
+   enum { ID_BTN_PAUSE = 19996, ID_BTN_STEP = 19997 };
 
    void showView (int iViewNumber);
 
index e9831843568d87a90af89727ac465c0ae928efc2..f6e2182409ad775f9074d3e45986c33b31b3fb3f 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dlgreconstruct.cpp,v 1.5 2000/09/07 14:29:05 kevin Exp $
+**  $Id: dlgreconstruct.cpp,v 1.6 2000/12/16 03:29:02 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
 
 BEGIN_EVENT_TABLE(ReconstructDialog, wxDialog)
    EVT_BUTTON(wxID_CANCEL, ReconstructDialog::OnCancel)
@@ -189,13 +196,13 @@ ReconstructDialog::showView (int iViewNumber)
     }
     unsigned char* imageData = new unsigned char [m_nxImage * m_nyImage * 3];
     double dScale = 255 / (maxValue - minValue);
-    for (int ix = 0; ix < m_nxImage; ix++) {
+    for (int ix2 = 0; ix2 < m_nxImage; ix2++) {
        for (int iy = 0; iy < m_nyImage; iy++) {
-           double dPixel = v[ix][iy];
+           double dPixel = v[ix2][iy];
            dPixel = (dPixel - minValue) * dScale;
            int intensity = nearest<int>(dPixel);
            intensity = clamp (intensity, 0, 255);
-           int baseAddr = ((m_nyImage - 1 - iy) * m_nxImage + ix) * 3;
+           int baseAddr = ((m_nyImage - 1 - iy) * m_nxImage + ix2) * 3;
            imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity;
        }
     }
index 0a4f7a64786ce4dc08cb5176e91fe25d02f76be9..fa44d89a8b640f9ed7efc29cc57d02e5141eb91a 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dlgreconstruct.h,v 1.2 2000/09/04 09:06:46 kevin Exp $
+**  $Id: dlgreconstruct.h,v 1.3 2000/12/16 03:29:02 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,10 +115,10 @@ private:
       Finished             // finished, waiting to be removed from screen
    } m_state;
 
-   const static int ID_BTN_PAUSE = 19998;
-   const static int ID_BTN_STEP = 19999;
-   const static int MAX_IMAGE_X = 400;
-   const static int MAX_IMAGE_Y = 400;
+   const static int ID_BTN_PAUSE;
+   const static int ID_BTN_STEP;
+   const static int MAX_IMAGE_X;
+   const static int MAX_IMAGE_Y;
 
    void showView (int iViewNumber);
 
index 8ceaf03501b79bd47e73e223d02ef27aa1b10c61..e94ca255c4563dd440d1419f2bdc099160292f5c 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.23 2000/10/11 08:16:08 kevin Exp $
+**  $Id: views.cpp,v 1.24 2000/12/16 03:29:02 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
@@ -96,7 +96,7 @@ ImageFileCanvas::OnMouseEvent(wxMouseEvent& event)
        int nx = rIF.nx();
        int ny = rIF.ny();
 
-       if (pt.x >= 0 && pt.x < nx && pt.y >= 0 & pt.y < ny) {
+       if (pt.x >= 0 && pt.x < nx && pt.y >= 0 && pt.y < ny) {
          ostringstream os;
          os << "Image value (" << pt.x << "," << pt.y << ") = " << v[pt.x][ny - 1 - pt.y] << "\n";
            *theApp->getLog() << os.str().c_str();
@@ -912,13 +912,13 @@ ProjectionFileView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)
 
        unsigned char* imageData = new unsigned char [nDet * nView * 3];
        double scale = (max - min) / 255;
-       for (int iy = 0; iy < nView; iy++) {
-           const DetectorArray& detarray = rProj.getDetectorArray(iy);
+       for (int iy2 = 0; iy2 < nView; iy2++) {
+           const DetectorArray& detarray = rProj.getDetectorArray (iy2);
            const DetectorValue* detval = detarray.detValues();
            for (int ix = 0; ix < nDet; ix++) {
                int intensity = static_cast<int>(((detval[ix] - min) / scale) + 0.5);
                intensity = clamp(intensity, 0, 255);
-               int baseAddr = (iy * nDet + ix) * 3;
+               int baseAddr = (iy2 * nDet + ix) * 3;
                imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity;
            }
        }