From 484b9ac2ebf8f88dbe36bdc1d3a9c1b6a2b242eb Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sat, 16 Dec 2000 03:29:02 +0000 Subject: [PATCH] r259: MSVC modifications --- include/array2dfile.h | 4 ++-- include/ctsupport.h | 43 +----------------------------------------- include/imagefile.h | 6 +++--- include/projections.h | 10 +++++----- include/scanner.h | 6 +++--- include/timer.h | 8 ++++---- src/ctsim.cpp | 18 +++++++++--------- src/ctsim.h | 4 ++-- src/dialogs.cpp | 17 +++++++++-------- src/dlgprojections.cpp | 7 ++++--- src/dlgprojections.h | 5 ++--- src/dlgreconstruct.cpp | 15 +++++++++++---- src/dlgreconstruct.h | 10 +++++----- src/views.cpp | 10 +++++----- 14 files changed, 65 insertions(+), 98 deletions(-) diff --git a/include/array2dfile.h b/include/array2dfile.h index 1a0d838..e5276e7 100644 --- a/include/array2dfile.h +++ b/include/array2dfile.h @@ -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::iterator labelIterator; typedef vector::const_iterator constLabelIterator; diff --git a/include/ctsupport.h b/include/ctsupport.h index 6263b69..6175543 100644 --- a/include/ctsupport.h +++ b/include/ctsupport.h @@ -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 /*----------------------------------------------------------------------*/ @@ -65,25 +62,6 @@ /*----------------------------------------------------------------------*/ -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 diff --git a/include/imagefile.h b/include/imagefile.h index ae090e7..dd0c0c9 100644 --- a/include/imagefile.h +++ b/include/imagefile.h @@ -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; diff --git a/include/projections.h b/include/projections.h index 03cb2da..eb1c3c7 100644 --- a/include/projections.h +++ b/include/projections.h @@ -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 diff --git a/include/scanner.h b/include/scanner.h index 8911976..f0b498b 100644 --- a/include/scanner.h +++ b/include/scanner.h @@ -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 */ diff --git a/include/timer.h b/include/timer.h index 78b19e9..d0b5d7f 100644 --- a/include/timer.h +++ b/include/timer.h @@ -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: diff --git a/src/ctsim.cpp b/src/ctsim.cpp index 2d094d3..93a0a71 100644 --- a/src/ctsim.cpp +++ b/src/ctsim.cpp @@ -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 @@ -50,10 +50,10 @@ #include "config.h" #endif #if defined(HAVE_GETOPT_H) || defined(HAVE_GETOPT_LONG) -#include +#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 diff --git a/src/ctsim.h b/src/ctsim.h index 8367f21..62d97c2 100644 --- a/src/ctsim.h +++ b/src/ctsim.h @@ -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]; diff --git a/src/dialogs.cpp b/src/dialogs.cpp index ce808b4..87542a9 100644 --- a/src/dialogs.cpp +++ b/src/dialogs.cpp @@ -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 @@ -59,13 +59,14 @@ 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; + 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); diff --git a/src/dlgprojections.cpp b/src/dlgprojections.cpp index 702befa..de6d0e6 100644 --- a/src/dlgprojections.cpp +++ b/src/dlgprojections.cpp @@ -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(); + delete detPos; } } } diff --git a/src/dlgprojections.h b/src/dlgprojections.h index d39260a..2038937 100644 --- a/src/dlgprojections.h +++ b/src/dlgprojections.h @@ -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); diff --git a/src/dlgreconstruct.cpp b/src/dlgreconstruct.cpp index e983184..f6e2182 100644 --- a/src/dlgreconstruct.cpp +++ b/src/dlgreconstruct.cpp @@ -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 @@ -57,6 +57,13 @@ static const int LAYOUT_X_MARGIN = 4; static const int LAYOUT_Y_MARGIN = 4; + + +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) @@ -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(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; } } diff --git a/src/dlgreconstruct.h b/src/dlgreconstruct.h index 0a4f7a6..fa44d89 100644 --- a/src/dlgreconstruct.h +++ b/src/dlgreconstruct.h @@ -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); diff --git a/src/views.cpp b/src/views.cpp index 8ceaf03..e94ca25 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -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(((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; } } -- 2.34.1