From f7d2b7144f32a7bd157b7689022e62944b82fcc1 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 21 Dec 2000 03:40:58 +0000 Subject: [PATCH] r310: plotfile updates --- ChangeLog | 7 +- include/ctsupport.h | 4 +- libctsim/imagefile.cpp | 10 +- libctsim/phantom.cpp | 21 ++- libctsupport/mathfuncs.cpp | 21 +-- libctsupport/plotfile.cpp | 10 +- msvc/ctsim/ctsim.plg | 13 +- msvc/libctsim/libctsim.dsp | 15 ++ src/ctsim.h | 5 +- src/dialogs.cpp | 365 +++++++++++++++++++------------------ src/dialogs.h | 6 +- src/views.cpp | 43 ++++- src/views.h | 3 +- 13 files changed, 298 insertions(+), 225 deletions(-) diff --git a/ChangeLog b/ChangeLog index 029bd14..63c618d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ 2.5.1 - Released 12/30/00 -12/18/00 Added plotfile class + * Added PlotFile class + * Added plotting of rows & columns to ctsim + * Updated if2 to output plot files + * Added y-axis scaling to plotting in ctsim + * Reworked statistics to share between imagefile and plotfile class + * Fixed scaling bug in rasterizing Phantom with nsample > 2 2.5.0 - 12/18/00 First Microsoft Windows GUI version diff --git a/include/ctsupport.h b/include/ctsupport.h index cea4f14..460af41 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.15 2000/12/20 20:08:48 kevin Exp $ +** $Id: ctsupport.h,v 1.16 2000/12/21 03:40:58 kevin Exp $ ** ** ** This program is free software; you can redistribute it and/or modify @@ -236,7 +236,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 vec, double& min, double& max, double& mean, double& mode, double& median, double& stddev); +void vectorNumericStatistics (std::vector vec, const int nPoints, double& min, double& max, double& mean, double& mode, double& median, double& stddev); /*----------------------------------------------------------------------*/ diff --git a/libctsim/imagefile.cpp b/libctsim/imagefile.cpp index d4c973c..b86ff79 100644 --- a/libctsim/imagefile.cpp +++ b/libctsim/imagefile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: imagefile.cpp,v 1.22 2000/12/20 20:08:48 kevin Exp $ +** $Id: imagefile.cpp,v 1.23 2000/12/21 03:40:58 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 @@ -233,13 +233,15 @@ ImageFile::statistics (double& min, double& max, double& mean, double& mode, dou if (v == NULL || nx == 0 || ny == 0) return; - std::vector vecImage (nx * ny); + std::vector vecImage; + int iVec = 0; + vecImage.resize (nx * ny); for (int ix = 0; ix < nx; ix++) { for (int iy = 0; iy < ny; iy++) - vecImage.push_back (v[ix][iy]); + vecImage[iVec++] = v[ix][iy]; } - vectorNumericStatistics (vecImage, min, max, mean, mode, median, stddev); + vectorNumericStatistics (vecImage, nx * ny, min, max, mean, mode, median, stddev); } diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index e6d4a62..9125e36 100644 --- a/libctsim/phantom.cpp +++ b/libctsim/phantom.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phantom.cpp,v 1.22 2000/12/16 06:12:47 kevin Exp $ +** $Id: phantom.cpp,v 1.23 2000/12/21 03:40:58 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 @@ -482,7 +482,7 @@ Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trac for (int iy = 0; iy < ny; iy++) { int iColStore = ix; if (bStoreAtColumnPos) - iColStore += colStart; + iColStore += colStart; v[iColStore][iy] = 0; } @@ -499,7 +499,7 @@ Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trac for (kx = 0, xi = x + kxofs; kx < nsample; kx++, xi += kxinc) { for (ky = 0, yi = y + kyofs; ky < nsample; ky++, yi += kyinc) if (rPElem.isPointInside (xi, yi, PHM_COORD) == TRUE) - v[iColStore][iy] += rPElem.atten(); + v[iColStore][iy] += rPElem.atten(); } // for kx } /* for iy */ } /* for ix */ @@ -507,11 +507,16 @@ Phantom::convertToImagefile (ImageFile& im, const int in_nsample, const int trac if (nsample > 1) { - double factor = 1.0 / (nsample * nsample); - - for (int ix = 0; ix < colCount; ix++) - for (int iy = 0; iy < ny; iy++) - v[ix][iy] *= factor; + double factor = 1.0 / static_cast(nsample * nsample); + + + for (int ix = 0; ix < colCount; ix++) { + int iColStore = ix; + if (bStoreAtColumnPos) + iColStore += colStart; + for (int iy = 0; iy < ny; iy++) + v[iColStore][iy] *= factor; + } } } diff --git a/libctsupport/mathfuncs.cpp b/libctsupport/mathfuncs.cpp index c074452..2eaa551 100644 --- a/libctsupport/mathfuncs.cpp +++ b/libctsupport/mathfuncs.cpp @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: mathfuncs.cpp,v 1.3 2000/12/20 20:08:48 kevin Exp $ +** $Id: mathfuncs.cpp,v 1.4 2000/12/21 03:40:58 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 @@ -84,17 +84,16 @@ normalizeAngle (double theta) void -vectorNumericStatistics (std::vector vec, double& min, double& max, double& mean, double& mode, double& median, double& stddev) +vectorNumericStatistics (std::vector vec, const int nPoints, double& min, double& max, double& mean, double& mode, double& median, double& stddev) { - int n = vec.size(); - if (n <= 0) + if (nPoints <= 0) return; mean = 0; min = vec[0]; max = vec[0]; int i; - for (i = 0; i < n; i++) { + for (i = 0; i < nPoints; i++) { double v = vec[i]; if (v > max) max = v; @@ -102,21 +101,21 @@ vectorNumericStatistics (std::vector vec, double& min, double& max, doub min = v; mean += v; } - mean /= n; + mean /= nPoints; static const int nbin = 1024; int hist[ nbin ] = {0}; double spread = max - min; mode = 0; stddev = 0; - for (i = 0; i < n; i++) { + for (i = 0; i < nPoints; i++) { double v = vec[i]; int b = static_cast((((v - min) / spread) * (nbin - 1)) + 0.5); hist[b]++; double diff = (v - mean); stddev += diff * diff; } - stddev = sqrt (stddev / n); + stddev = sqrt (stddev / nPoints); int max_binindex = 0; int max_bin = -1; @@ -131,8 +130,8 @@ vectorNumericStatistics (std::vector vec, double& min, double& max, doub std::sort(vec.begin(), vec.end()); - if (n % 2) // Odd - median = vec[((n - 1) / 2)]; + if (nPoints % 2) // Odd + median = vec[((nPoints - 1) / 2)]; else // Even - median = (vec[ (n / 2) - 1 ] + vec[ n / 2 ]) / 2; + median = (vec[ (nPoints / 2) - 1 ] + vec[ nPoints / 2 ]) / 2; } diff --git a/libctsupport/plotfile.cpp b/libctsupport/plotfile.cpp index 5a160cd..b9e8ac6 100644 --- a/libctsupport/plotfile.cpp +++ b/libctsupport/plotfile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: plotfile.cpp,v 1.3 2000/12/20 20:08:48 kevin Exp $ +** $Id: plotfile.cpp,v 1.4 2000/12/21 03:40:58 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 @@ -153,15 +153,17 @@ PlotFile::statistics (int iStartingCol, double& min, double& max, double& mean, int iOffset = iStartingCol * m_iNumRecords; int iNPoints = (m_iNumColumns - iStartingCol) * m_iNumRecords; - std::vector vec (iNPoints); + std::vector 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.push_back( m_vecCurves[ iRec + iOffset ] ); + vec[iVec++] = m_vecCurves[ iRec + iOffset ]; } - vectorNumericStatistics (vec, min, max, mean, mode, median, stddev); + vectorNumericStatistics (vec, iNPoints, min, max, mean, mode, median, stddev); return true; } diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index dfc535a..9ec4c1f 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -6,14 +6,13 @@ --------------------Configuration: ctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP16A.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EF.tmp" with contents [ /nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "\wx2\include" /I "." /I "..\..\include" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\zlib" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"2.5.0\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"2.5.0\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"C:\ctsim-2.0.6\src\dialogs.cpp" "C:\ctsim-2.0.6\src\views.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP16A.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP16B.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EF.tmp" +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1F0.tmp" with contents [ comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libctsim/Debug/libctsim.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\lpng108\msvc\win32\libpng\lib_dbg\libpng.lib ..\..\..\lpng108\msvc\win32\zlib\lib_dbg\zlib.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib ../../../wx2/lib/wxd.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrtd.lib" /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" ".\Debug\ctsim.obj" @@ -28,20 +27,20 @@ comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib w "\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib" "\wx2\lib\wxd.lib" ] -Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP16B.tmp" +Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1F0.tmp"

Output Window

Compiling... -dialogs.cpp views.cpp Linking... Creating command line "bscmake.exe /nologo /o"Debug/ctsim.bsc" ".\Debug\ctsim.sbr" ".\Debug\dialogs.sbr" ".\Debug\dlgprojections.sbr" ".\Debug\dlgreconstruct.sbr" ".\Debug\docs.sbr" ".\Debug\views.sbr"" Creating browse info file... +BSCMAKE: warning BK4503 : minor error in .SBR file '.\Debug\views.sbr' ignored

Output Window

Results

-ctsim.exe - 0 error(s), 0 warning(s) +ctsim.exe - 0 error(s), 1 warning(s) diff --git a/msvc/libctsim/libctsim.dsp b/msvc/libctsim/libctsim.dsp index 9f377be..22f5b3b 100644 --- a/msvc/libctsim/libctsim.dsp +++ b/msvc/libctsim/libctsim.dsp @@ -94,8 +94,19 @@ SOURCE=..\..\libctsim\array2dfile.cpp # Begin Source File SOURCE=..\..\libctsim\backprojectors.cpp + +!IF "$(CFG)" == "libctsim - Win32 Release" + # ADD CPP /GR- # SUBTRACT CPP /X + +!ELSEIF "$(CFG)" == "libctsim - Win32 Debug" + +# ADD CPP /GR +# SUBTRACT CPP /X + +!ENDIF + # End Source File # Begin Source File @@ -243,6 +254,10 @@ SOURCE=..\..\include\mpiworld.h # End Source File # Begin Source File +SOURCE=..\..\include\msvc_compat.h +# End Source File +# Begin Source File + SOURCE=..\..\include\phantom.h # End Source File # Begin Source File diff --git a/src/ctsim.h b/src/ctsim.h index d925599..486224b 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.10 2000/12/20 20:08:48 kevin Exp $ +** $Id: ctsim.h,v 1.11 2000/12/21 03:40:58 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 @@ -135,7 +135,8 @@ enum { IFMENU_PLOT_ROW, IFMENU_PLOT_COL, IFMENU_VIEW_SCALE_AUTO, - IFMENU_VIEW_SCALE_MINMAX, + IFMENU_VIEW_SCALE_MINMAX, + IFMENU_COMPARE_IMAGES, PHMMENU_PROCESS_RASTERIZE, PHMMENU_PROCESS_PROJECTIONS, PLOTMENU_VIEW_SCALE_MINMAX, diff --git a/src/dialogs.cpp b/src/dialogs.cpp index 622efb2..66191bb 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.18 2000/12/20 20:08:48 kevin Exp $ +** $Id: dialogs.cpp,v 1.19 2000/12/21 03:40:58 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 @@ -61,17 +61,22 @@ #endif +/////////////////////////////////////////////////////////////////////// +// CLASS IMPLEMENTATION +// StringValueAndTitleListBox +/////////////////////////////////////////////////////////////////////// + StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[]) - : wxListBox () +: wxListBox () { - wxString* psTitle = new wxString [nChoices]; - for (int i = 0; i < nChoices; i++) - psTitle[i] = aszTitle[i]; - - Create (pParent, -1, wxDefaultPosition, wxSize(200,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB); - - m_ppszValues = aszValue; - delete [] psTitle; + wxString* psTitle = new wxString [nChoices]; + for (int i = 0; i < nChoices; i++) + psTitle[i] = aszTitle[i]; + + Create (pParent, -1, wxDefaultPosition, wxSize(200,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB); + + m_ppszValues = aszValue; + delete [] psTitle; }; const char* @@ -81,30 +86,34 @@ StringValueAndTitleListBox::getSelectionStringValue (void) const } +/////////////////////////////////////////////////////////////////////// +// CLASS IMPLEMENTATION +// DialogGetPhantom +/////////////////////////////////////////////////////////////////////// DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, int iDefaultPhantom) - : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +: wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); - + pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxALIGN_CENTER | wxALL, 5); - + pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5); - + m_pListBoxPhantom = new StringValueAndTitleListBox (this, Phantom::getPhantomCount(), Phantom::getPhantomTitleArray(), Phantom::getPhantomNameArray()); m_pListBoxPhantom->SetSelection (iDefaultPhantom); pTopSizer->Add (m_pListBoxPhantom, 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); @@ -114,7 +123,7 @@ DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, int iDefaultPhantom) const char* DialogGetPhantom::getPhantom(void) { - return m_pListBoxPhantom->getSelectionStringValue(); + return m_pListBoxPhantom->getSelectionStringValue(); } @@ -123,38 +132,38 @@ DialogGetPhantom::getPhantom(void) ///////////////////////////////////////////////////////////////////// DialogGetMinMax::DialogGetMinMax (wxFrame* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax) - : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { 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 << dDefaultMin; m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0); std::ostringstream osMax; osMax << dDefaultMax; m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0); - + wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2); pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL); pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pGridSizer->Add (m_pTextCtrlMax, 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); @@ -168,23 +177,23 @@ DialogGetMinMax::~DialogGetMinMax (void) double DialogGetMinMax::getMinimum (void) { - wxString strCtrl = m_pTextCtrlMin->GetValue(); - double dValue; - if (strCtrl.ToDouble (&dValue)) - return dValue; - else - return (m_dDefaultMin); + wxString strCtrl = m_pTextCtrlMin->GetValue(); + double dValue; + if (strCtrl.ToDouble (&dValue)) + return dValue; + else + return (m_dDefaultMin); } double DialogGetMinMax::getMaximum (void) { - wxString strCtrl = m_pTextCtrlMax->GetValue(); - double dValue; - if (strCtrl.ToDouble (&dValue)) - return dValue; - else - return (m_dDefaultMax); + wxString strCtrl = m_pTextCtrlMax->GetValue(); + double dValue; + if (strCtrl.ToDouble (&dValue)) + return dValue; + else + return (m_dDefaultMax); } @@ -193,23 +202,23 @@ DialogGetMinMax::getMaximum (void) ///////////////////////////////////////////////////////////////////// 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) +: 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; @@ -217,17 +226,17 @@ DialogAutoScaleParameters::DialogAutoScaleParameters (wxFrame *pParent, double m 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); @@ -248,13 +257,13 @@ DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax) double dValue; if (! sStddevFactor.ToDouble (&dValue)) { *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n"; - return false; + 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; } @@ -266,7 +275,7 @@ DialogAutoScaleParameters::getAutoScaleFactor () if (! sStddevFactor.ToDouble (&dValue)) { *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n"; } - + return dValue; } @@ -278,14 +287,14 @@ DialogAutoScaleParameters::getAutoScaleFactor () ///////////////////////////////////////////////////////////////////// DialogGetRasterParameters::DialogGetRasterParameters (wxFrame* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples) - : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +: wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); - + pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization 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); @@ -295,7 +304,7 @@ DialogGetRasterParameters::DialogGetRasterParameters (wxFrame* pParent, int iDef std::ostringstream osNSamples; osNSamples << iDefaultNSamples; m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.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); @@ -304,17 +313,17 @@ DialogGetRasterParameters::DialogGetRasterParameters (wxFrame* pParent, int iDef pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pGridSizer->Add (m_pTextCtrlNSamples, 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); @@ -329,35 +338,35 @@ DialogGetRasterParameters::~DialogGetRasterParameters (void) unsigned int DialogGetRasterParameters::getXSize (void) { - wxString strCtrl = m_pTextCtrlXSize->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultXSize); + wxString strCtrl = m_pTextCtrlXSize->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultXSize); } unsigned int DialogGetRasterParameters::getYSize (void) { - wxString strCtrl = m_pTextCtrlYSize->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultYSize); + wxString strCtrl = m_pTextCtrlYSize->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultYSize); } unsigned int DialogGetRasterParameters::getNSamples (void) { - wxString strCtrl = m_pTextCtrlNSamples->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultNSamples); + wxString strCtrl = m_pTextCtrlNSamples->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultNSamples); } @@ -370,10 +379,10 @@ DialogGetRasterParameters::getNSamples (void) DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples, double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultFieldOfView, int iDefaultGeometry, int iDefaultTrace) - : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +: wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); - + m_dDefaultRotAngle = dDefaultRotAngle; m_dDefaultFocalLength = dDefaultFocalLength; m_dDefaultFieldOfView = dDefaultFieldOfView; @@ -382,11 +391,11 @@ DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, m_iDefaultNDet = iDefaultNDet; m_iDefaultTrace = iDefaultTrace; m_iDefaultGeometry = iDefaultGeometry; - + pTopSizer->Add (new wxStaticText (this, -1, "Set Projection 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 << iDefaultNDet; m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0); @@ -405,14 +414,14 @@ DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, std::ostringstream osFieldOfView; osFieldOfView << dDefaultFieldOfView; m_pTextCtrlFieldOfView = new wxTextCtrl (this, -1, osFieldOfView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0); - + wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2); pGridSizer->Add (new wxStaticText (this, -1, "Scanner Geometry"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); m_pListBoxGeometry = new StringValueAndTitleListBox (this, Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray()); m_pListBoxGeometry->SetSelection (iDefaultGeometry); - + pGridSizer->Add (m_pListBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND); - + pGridSizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pGridSizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL); pGridSizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); @@ -425,24 +434,24 @@ DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, pGridSizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL); pGridSizer->Add (new wxStaticText (this, -1, "Field of View (phantom diameter units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pGridSizer->Add (m_pTextCtrlFieldOfView, 0, wxALIGN_CENTER_VERTICAL); - + m_pListBoxTrace = new StringValueAndTitleListBox (this, Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray()); m_pListBoxTrace->SetSelection (iDefaultTrace); - + pGridSizer->Add (new wxStaticText (this, -1, "Trace Level"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pGridSizer->Add (m_pListBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND); 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); @@ -457,68 +466,68 @@ DialogGetProjectionParameters::~DialogGetProjectionParameters (void) unsigned int DialogGetProjectionParameters::getNDet (void) { - wxString strCtrl = m_pTextCtrlNDet->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultNDet); + wxString strCtrl = m_pTextCtrlNDet->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultNDet); } unsigned int DialogGetProjectionParameters::getNView (void) { - wxString strCtrl = m_pTextCtrlNView->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultNView); + wxString strCtrl = m_pTextCtrlNView->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultNView); } unsigned int DialogGetProjectionParameters::getNSamples (void) { - wxString strCtrl = m_pTextCtrlNSamples->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultNSamples); + wxString strCtrl = m_pTextCtrlNSamples->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultNSamples); } double DialogGetProjectionParameters::getRotAngle (void) { - wxString strCtrl = m_pTextCtrlRotAngle->GetValue(); - double dValue; - if (strCtrl.ToDouble (&dValue)) - return (dValue * PI); - else - return (m_dDefaultRotAngle); + wxString strCtrl = m_pTextCtrlRotAngle->GetValue(); + double dValue; + if (strCtrl.ToDouble (&dValue)) + return (dValue * PI); + else + return (m_dDefaultRotAngle); } double DialogGetProjectionParameters::getFocalLengthRatio (void) { - wxString strCtrl = m_pTextCtrlFocalLength->GetValue(); - double dValue; - if (strCtrl.ToDouble (&dValue)) - return (dValue); - else - return (m_dDefaultFocalLength); + wxString strCtrl = m_pTextCtrlFocalLength->GetValue(); + double dValue; + if (strCtrl.ToDouble (&dValue)) + return (dValue); + else + return (m_dDefaultFocalLength); } double DialogGetProjectionParameters::getFieldOfViewRatio (void) { - wxString strCtrl = m_pTextCtrlFieldOfView->GetValue(); - double dValue; - if (strCtrl.ToDouble (&dValue)) - return (dValue); - else - return (m_dDefaultFieldOfView); + wxString strCtrl = m_pTextCtrlFieldOfView->GetValue(); + double dValue; + if (strCtrl.ToDouble (&dValue)) + return (dValue); + else + return (m_dDefaultFieldOfView); } const char* @@ -543,14 +552,14 @@ DialogGetProjectionParameters::getTrace (void) DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad, int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace) - : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +: wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); - + pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction 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); @@ -566,35 +575,35 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* p std::ostringstream osInterpParam; osInterpParam << iDefaultInterpParam; m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0); - + wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (6); 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_pListBoxFilterMethod = new StringValueAndTitleListBox (this, ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray()); m_pListBoxFilterMethod->SetSelection (iDefaultFilterMethodID); pGridSizer->Add (new wxStaticText (this, -1, "Filter Method"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5); pGridSizer->Add (m_pListBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND); - + m_pListBoxFilterGeneration = new StringValueAndTitleListBox (this, ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray()); 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); - + m_pListBoxBackproject = new StringValueAndTitleListBox (this, Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray()); m_pListBoxBackproject->SetSelection (iDefaultBackprojectID); pGridSizer->Add (new wxStaticText (this, -1, "Backprojection"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5); pGridSizer->Add (m_pListBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND); - + m_pListBoxInterp = new StringValueAndTitleListBox (this, Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray()); m_pListBoxInterp->SetSelection (iDefaultInterpID); pGridSizer->Add (new wxStaticText (this, -1, "Interpolation"), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5); pGridSizer->Add (m_pListBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND); - - + + 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"}; @@ -602,7 +611,7 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* p 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); @@ -613,19 +622,19 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* p pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pGridSizer->Add (m_pTextCtrlInterpParam, 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(); @@ -641,57 +650,57 @@ DialogGetReconstructionParameters::~DialogGetReconstructionParameters (void) unsigned int DialogGetReconstructionParameters::getXSize (void) { - wxString strCtrl = m_pTextCtrlXSize->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultXSize); + wxString strCtrl = m_pTextCtrlXSize->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultXSize); } unsigned int DialogGetReconstructionParameters::getYSize (void) { - wxString strCtrl = m_pTextCtrlYSize->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultYSize); + wxString strCtrl = m_pTextCtrlYSize->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultYSize); } unsigned int DialogGetReconstructionParameters::getZeropad (void) { - wxString strCtrl = m_pTextCtrlZeropad->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultZeropad); + wxString strCtrl = m_pTextCtrlZeropad->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultZeropad); } unsigned int DialogGetReconstructionParameters::getInterpParam (void) { - wxString strCtrl = m_pTextCtrlInterpParam->GetValue(); - unsigned long lValue; - if (strCtrl.ToULong (&lValue)) - return lValue; - else - return (m_iDefaultInterpParam); + wxString strCtrl = m_pTextCtrlInterpParam->GetValue(); + unsigned long lValue; + if (strCtrl.ToULong (&lValue)) + return lValue; + else + return (m_iDefaultInterpParam); } double DialogGetReconstructionParameters::getFilterParam (void) { - wxString strCtrl = m_pTextCtrlFilterParam->GetValue(); - double dValue; - if (strCtrl.ToDouble (&dValue)) - return (dValue); - else - return (m_dDefaultFilterParam); + wxString strCtrl = m_pTextCtrlFilterParam->GetValue(); + double dValue; + if (strCtrl.ToDouble (&dValue)) + return (dValue); + else + return (m_dDefaultFilterParam); } const char* @@ -717,7 +726,7 @@ DialogGetReconstructionParameters::getTrace (void) { int iTrace = 0; if (strcmp("full", m_pListBoxTrace->getSelectionStringValue()) == 0) - iTrace = Trace::TRACE_PLOT; + iTrace = Trace::TRACE_PLOT; return iTrace; } diff --git a/src/dialogs.h b/src/dialogs.h index b14fa78..c4c6647 100644 --- a/src/dialogs.h +++ b/src/dialogs.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: dialogs.h,v 1.14 2000/12/20 20:08:48 kevin Exp $ +** $Id: dialogs.h,v 1.15 2000/12/21 03:40:58 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,8 @@ #include "scanner.h" #include "phantom.h" #include "procsignal.h" -#include "filter.h" +#include "filter.h" + // CLASS StringValueAndTitleListBox // @@ -65,6 +66,7 @@ class DialogGetPhantom : public wxDialog private: StringValueAndTitleListBox* m_pListBoxPhantom; }; + class ImageFile; diff --git a/src/views.cpp b/src/views.cpp index 04adab9..68b0375 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.34 2000/12/20 20:08:48 kevin Exp $ +** $Id: views.cpp,v 1.35 2000/12/21 03:40:58 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 @@ -165,7 +165,8 @@ BEGIN_EVENT_TABLE(ImageFileView, wxView) EVT_MENU(IFMENU_FILE_PROPERTIES, ImageFileView::OnProperties) EVT_MENU(IFMENU_VIEW_SCALE_MINMAX, ImageFileView::OnScaleMinMax) EVT_MENU(IFMENU_VIEW_SCALE_AUTO, ImageFileView::OnScaleAuto) -EVT_MENU(IFMENU_PLOT_ROW, ImageFileView::OnPlotRow) +EVT_MENU(IFMENU_COMPARE_IMAGES, ImageFileView::OnCompare) +EVT_MENU(IFMENU_PLOT_ROW, ImageFileView::OnPlotRow) EVT_MENU(IFMENU_PLOT_COL, ImageFileView::OnPlotCol) END_EVENT_TABLE() @@ -240,7 +241,31 @@ ImageFileView::OnScaleMinMax (wxCommandEvent& event) OnUpdate (this, NULL); } } - + +void +ImageFileView::OnCompare (wxCommandEvent& event) +{ + wxList& rListDocs = theApp->getDocManager()->GetDocuments(); + std::vector vecIF; + std::vector vecFilename; + int nCompares = 0; + for (wxNode* pNode = rListDocs.GetFirst(); pNode != NULL; pNode = pNode->GetNext()) { + wxDocument* pDoc = reinterpret_cast(pNode->GetData()); + ImageFileDocument* pIFDoc = dynamic_cast(pDoc); + if (pIFDoc) { + if (pIFDoc->GetFirstView() != this) { + std::string strFilename = pDoc->GetFilename(); + vecIF.push_back (pIFDoc); + vecFilename.push_back (strFilename); + nCompares++; + } + } + } + for (int i = 0; i < nCompares; i++) { + const std::string& s = vecFilename[i]; + *theApp->getLog() << s.c_str() << "\n"; + } +} ImageFileCanvas* ImageFileView::CreateCanvas (wxView *view, wxFrame *parent) @@ -287,6 +312,9 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) plot_menu->Append (IFMENU_PLOT_ROW, "Plot &Row"); plot_menu->Append (IFMENU_PLOT_COL, "Plot &Column"); + wxMenu *compare_menu = new wxMenu; + compare_menu->Append (IFMENU_COMPARE_IMAGES, "&Compare Images"); + wxMenu *help_menu = new wxMenu; help_menu->Append(MAINMENU_HELP_ABOUT, "&About"); @@ -294,7 +322,8 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) menu_bar->Append(file_menu, "&File"); menu_bar->Append(view_menu, "&View"); - menu_bar->Append(plot_menu, "&Plot"); + menu_bar->Append(plot_menu, "&Plot"); + menu_bar->Append(compare_menu, "&Compare"); menu_bar->Append(help_menu, "&Help"); subframe->SetMenuBar(menu_bar); @@ -1168,7 +1197,7 @@ EVT_MENU(PLOTMENU_VIEW_SCALE_AUTO, PlotFileView::OnScaleAuto) END_EVENT_TABLE() PlotFileView::PlotFileView(void) -: wxView(), m_canvas(NULL), m_frame(NULL), m_bMinSpecified(false), m_bMaxSpecified(false) +: wxView(), m_canvas(NULL), m_frame(NULL) { } @@ -1304,6 +1333,10 @@ PlotFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) m_frame = CreateChildFrame(doc, this); SetFrame(m_frame); + m_bMinSpecified = false; + m_bMaxSpecified = false; + m_dAutoScaleFactor = 1.; + int width, height; m_frame->GetClientSize(&width, &height); m_frame->SetTitle ("Plot File"); diff --git a/src/views.h b/src/views.h index 12daabd..d06ffa3 100644 --- a/src/views.h +++ b/src/views.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: views.h,v 1.14 2000/12/20 20:08:48 kevin Exp $ +** $Id: views.h,v 1.15 2000/12/21 03:40:58 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 @@ -65,6 +65,7 @@ public: void OnUpdate(wxView *sender, wxObject *hint = NULL); bool OnClose (bool deleteWindow = true); void OnProperties (wxCommandEvent& event); + void OnCompare (wxCommandEvent& event); void OnScaleAuto (wxCommandEvent& event); void OnScaleMinMax (wxCommandEvent& event); void OnPlotRow (wxCommandEvent& event); -- 2.34.1