r156: *** empty log message ***
[ctsim.git] / src / dialogs.cpp
index b084fd4c4fba2c7716c84a807cdea58d13ef78ff..27b454f0ff857dabbca266e00399557414ed7814 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dialogs.cpp,v 1.3 2000/07/19 04:33:27 kevin Exp $
+**  $Id: dialogs.cpp,v 1.4 2000/07/20 11:17:31 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 "backprojectors.h"
 
 
+
+const wxString DialogGetPhantom::s_asPhantom[] = 
+{ 
+    wxString(Phantom::PHM_HERMAN_STR),
+    wxString(Phantom::PHM_BHERMAN_STR),
+    wxString(Phantom::PHM_ROWLAND_STR),
+    wxString(Phantom::PHM_BROWLAND_STR),
+    wxString(Phantom::PHM_UNITPULSE_STR),
+};
+const wxString DialogGetPhantom::s_asPhantomTitle[] = 
+{ 
+    wxString(Phantom::PHM_HERMAN_TITLE_STR),
+    wxString(Phantom::PHM_BHERMAN_TITLE_STR),
+    wxString(Phantom::PHM_ROWLAND_TITLE_STR),
+    wxString(Phantom::PHM_BROWLAND_TITLE_STR),
+    wxString(Phantom::PHM_UNITPULSE_TITLE_STR),
+};
+const unsigned int DialogGetPhantom::s_iNumPhantom = sizeof(s_asPhantom) / sizeof(wxString);
+
+
 DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, const char* szDefaultPhantom = NULL)
     : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
 {
@@ -66,13 +86,7 @@ DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, const char* szDefaultPhant
                   
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
 
-  wxString aListPhantomTitle [5];
-  aListPhantomTitle[0] = Phantom::PHM_HERMAN_TITLE_STR;
-  aListPhantomTitle[1] = Phantom::PHM_BHERMAN_TITLE_STR;
-  aListPhantomTitle[2] = Phantom::PHM_ROWLAND_TITLE_STR;
-  aListPhantomTitle[3] = Phantom::PHM_BROWLAND_TITLE_STR;
-  aListPhantomTitle[4] = Phantom::PHM_UNITPULSE_TITLE_STR;
-  m_pListBoxPhantom = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, 5, aListPhantomTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
+  m_pListBoxPhantom = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumPhantom, s_asPhantomTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
   pTopSizer->Add (m_pListBoxPhantom, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
 
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
@@ -91,19 +105,12 @@ DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, const char* szDefaultPhant
   pTopSizer->SetSizeHints (this);
 }
 
-string
+const wxString&
 DialogGetPhantom::getPhantom(void)
 {
-    string aListPhantom [5];
-    aListPhantom[0] = Phantom::PHM_HERMAN_STR;
-    aListPhantom[1] = Phantom::PHM_BHERMAN_STR;
-    aListPhantom[2] = Phantom::PHM_ROWLAND_STR;;
-    aListPhantom[3] = Phantom::PHM_BROWLAND_STR;
-    aListPhantom[4] = Phantom::PHM_UNITPULSE_STR;
-
     int selection = m_pListBoxPhantom->GetSelection();
     if (selection >= 0)
-       return (aListPhantom[selection]);
+       return (s_asPhantom[selection]);
 
     return (m_sDefaultPhantom);
 }
@@ -276,6 +283,21 @@ DialogGetRasterParameters::getNSamples (void)
 // DialogGetProjectionParameters
 /////////////////////////////////////////////////////////////////////
 
+const wxString DialogGetProjectionParameters::s_asGeometry[] = 
+{ 
+    wxString(Scanner::GEOMETRY_PARALLEL_STR),
+    wxString(Scanner::GEOMETRY_EQUILINEAR_STR),
+    wxString(Scanner::GEOMETRY_EQUIANGULAR_STR),
+};
+const wxString DialogGetProjectionParameters::s_asGeometryTitle[] = 
+{ 
+    wxString(Scanner::GEOMETRY_PARALLEL_TITLE_STR),
+    wxString(Scanner::GEOMETRY_EQUILINEAR_TITLE_STR),
+    wxString(Scanner::GEOMETRY_EQUIANGULAR_TITLE_STR),
+};
+const unsigned int DialogGetProjectionParameters::s_iNumGeometry = sizeof(s_asGeometry) / sizeof(wxString);
+
+
 DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet = 0, int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., const char* szDefaultGeometry = NULL)
     : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
 {
@@ -285,6 +307,9 @@ DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent,
                   
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
 
+  m_pListBoxGeometry = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumGeometry, s_asGeometryTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
+  pTopSizer->Add (m_pListBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+
   ostringstream os;
   os << iDefaultNDet;
   m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
@@ -376,10 +401,14 @@ DialogGetProjectionParameters::getRotAngle (void)
       return (m_dDefaultRotAngle);
 }
 
-const string&
+const wxString&
 DialogGetProjectionParameters::getGeometry (void)
 {
-  return m_sDefaultGeometry;
+    int selection = m_pListBoxGeometry->GetSelection();
+    if (selection >= 0)
+       return (s_asGeometry[selection]);
+
+    return m_sDefaultGeometry;
 }
 
 
@@ -390,6 +419,32 @@ DialogGetProjectionParameters::getGeometry (void)
 // DialogGetReconstructionParameters
 /////////////////////////////////////////////////////////////////////
 
+const wxString DialogGetReconstructionParameters::s_asFilter[] = 
+{ 
+    wxString(SignalFilter::FILTER_ABS_BANDLIMIT_STR),
+    wxString(SignalFilter::FILTER_SHEPP_STR),
+};
+const wxString DialogGetReconstructionParameters::s_asFilterTitle[] = 
+{ 
+    wxString(SignalFilter::FILTER_ABS_BANDLIMIT_TITLE_STR),
+    wxString(SignalFilter::FILTER_SHEPP_TITLE_STR),
+};
+const unsigned int DialogGetReconstructionParameters::s_iNumFilter = sizeof(s_asFilter) / sizeof(wxString);
+
+
+const wxString DialogGetReconstructionParameters::s_asInterp[] = 
+{ 
+  wxString(Backprojector::INTERP_NEAREST_STR),
+    wxString(Backprojector::INTERP_LINEAR_STR),
+};
+const wxString DialogGetReconstructionParameters::s_asInterpTitle[] = 
+{ 
+  wxString(Backprojector::INTERP_NEAREST_TITLE_STR),
+    wxString(Backprojector::INTERP_LINEAR_TITLE_STR),
+    };
+const unsigned int DialogGetReconstructionParameters::s_iNumInterp = sizeof(s_asInterp) / sizeof(wxString);
+
+
 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, const char* szDefaultFilterName = NULL, double dDefaultFilterParam = 1.,  const char* szDefaultFilterMethodName = NULL, int iDefaultZeropad = 3, const char* szDefaultInterpName = NULL, int iDefaultInterpParam = 1, const char* szDefaultBackprojName = NULL)
     : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
 {
@@ -399,6 +454,12 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* p
                   
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
 
+  m_pListBoxFilter = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumFilter, s_asFilterTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
+  pTopSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+
+  m_pListBoxInterp = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumInterp, s_asInterpTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
+  pTopSizer->Add (m_pListBoxInterp, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+
   ostringstream os;
   os << iDefaultXSize;
   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
@@ -428,15 +489,6 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* p
   pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_CENTER_VERTICAL);
   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
 
-  wxString aTitlesFilter[4];
-  aTitlesFilter[0] = "Abs * Bandlimit";
-  aTitlesFilter[1] = "Abs * Hamming";
-  aTitlesFilter[2] = "Abs * Hanning";
-  aTitlesFilter[3] = "Abs * Cosine";
-
-  m_pListBoxFilter = new wxListBox (this, -1, wxDefaultPosition, wxSize(-1,-1), 4, aTitlesFilter, wxLB_SINGLE | wxLB_NEEDED_SB);
-  pTopSizer->Add (m_pListBoxFilter);
-
   m_sDefaultFilterName = szDefaultFilterName;
   m_sDefaultFilterMethodName = szDefaultFilterMethodName;
   m_sDefaultInterpName = szDefaultInterpName;
@@ -519,25 +571,33 @@ DialogGetReconstructionParameters::getFilterParam (void)
       return (m_dDefaultFilterParam);
 }
 
-const string&
+const wxString&
 DialogGetReconstructionParameters::getFilterName (void)
 {
-  return m_sDefaultFilterName;
+    int selection = m_pListBoxFilter->GetSelection();
+    if (selection >= 0)
+       return (s_asFilter[selection]);
+
+    return m_sDefaultFilterName;
 }
 
-const string&
+const wxString&
 DialogGetReconstructionParameters::getFilterMethodName (void)
 {
   return m_sDefaultFilterMethodName;
 }
 
-const string&
+const wxString&
 DialogGetReconstructionParameters::getInterpName (void)
 {
-  return m_sDefaultInterpName;
+    int selection = m_pListBoxInterp->GetSelection();
+    if (selection >= 0)
+       return (s_asInterp[selection]);
+
+    return m_sDefaultInterpName;
 }
 
-const string&
+const wxString&
 DialogGetReconstructionParameters::getBackprojName (void)
 {
   return m_sDefaultBackprojName;