r520: no message
[ctsim.git] / src / dialogs.cpp
index c120591a2e7b5930f425f0de6a714ffc851217f7..0afae267baa58b0d64d4f0a9615943fe46eae1ad 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: dialogs.cpp,v 1.28 2001/02/08 06:25:07 kevin Exp $
+**  $Id: dialogs.cpp,v 1.29 2001/02/11 04:56:38 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
@@ -508,11 +508,13 @@ DialogGetProjectionParameters::DialogGetProjectionParameters
   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
   pGridSizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
-  std::ostringstream osRotAngle;
-  osRotAngle << dDefaultRotAngle;
-  m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
-  pGridSizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
-  pGridSizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
+  if (theApp->getAdvancedOptions()) {
+    std::ostringstream osRotAngle;
+    osRotAngle << dDefaultRotAngle;
+    m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+    pGridSizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    pGridSizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
+  }
   std::ostringstream osFocalLength;
   osFocalLength << dDefaultFocalLength;
   m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
@@ -594,12 +596,20 @@ DialogGetProjectionParameters::getNSamples ()
 double
 DialogGetProjectionParameters::getRotAngle ()
 {
-  wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
-  double dValue;
-  if (strCtrl.ToDouble (&dValue))
-    return (dValue * PI);
-  else
-    return (m_dDefaultRotAngle);
+  if (theApp->getAdvancedOptions()) {
+    wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
+    double dValue;
+    if (strCtrl.ToDouble (&dValue))
+      return (dValue * PI);
+    else
+      return (m_dDefaultRotAngle);
+  } else {
+    if (Scanner::convertGeometryNameToID (m_pListBoxGeometry->getSelectionStringValue()) == 
+          Scanner::GEOMETRY_PARALLEL)
+      return (PI);
+    else
+      return (2 * PI);
+  }
 }
 
 double
@@ -656,7 +666,10 @@ DialogGetProjectionParameters::getTrace ()
 /////////////////////////////////////////////////////////////////////
 
 
-DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam,  int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad, int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
+DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* 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)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
@@ -665,25 +678,13 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow*
   
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
   
-  std::ostringstream os;
-  os << iDefaultXSize;
-  m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
-  std::ostringstream osYSize;
-  osYSize << iDefaultYSize;
-  m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
-  std::ostringstream osFilterParam;
-  osFilterParam << dDefaultFilterParam;
-  m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
-  std::ostringstream osZeropad;
-  osZeropad << iDefaultZeropad;
-  m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
-  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());
+
+  if (theApp->getAdvancedOptions())
+    m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
+  else
+    m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
   m_pListBoxFilter->SetSelection (iDefaultFilterID);
   pGridSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
   
@@ -692,17 +693,18 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow*
   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);
+  if (theApp->getAdvancedOptions()) {
+    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);
@@ -717,16 +719,37 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow*
   m_pListBoxTrace->SetSelection (iTrace);
   pGridSizer->Add (m_pListBoxTrace);
   
+  std::ostringstream osHammingParam;
+  osHammingParam << dDefaultFilterParam;
+  m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  pGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+  std::ostringstream os;
+  os << iDefaultXSize;
+  m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+  std::ostringstream osYSize;
+  osYSize << iDefaultYSize;
+  m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
-  pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
-  pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
-  pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
-  pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+
+  if (theApp->getAdvancedOptions()) {
+    std::ostringstream osZeropad;
+    osZeropad << iDefaultZeropad;
+    m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+    pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+  }
+
+#if HAVE_FREQ_PREINTERP
+  std::ostringstream osInterpParam;
+  osInterpParam << iDefaultInterpParam;
+  m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+#endif  
   
   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
   
@@ -777,24 +800,31 @@ DialogGetReconstructionParameters::getYSize ()
 unsigned int
 DialogGetReconstructionParameters::getZeropad ()
 {
-  wxString strCtrl = m_pTextCtrlZeropad->GetValue();
-  unsigned long lValue;
-  if (strCtrl.ToULong (&lValue))
-    return lValue;
-  else
-    return (m_iDefaultZeropad);
+  if (theApp->getAdvancedOptions()) {
+    wxString strCtrl = m_pTextCtrlZeropad->GetValue();
+    unsigned long lValue;
+    if (strCtrl.ToULong (&lValue))
+      return lValue;
+    else
+      return (m_iDefaultZeropad);
+  } else
+    return 1;
 }
 
 
 unsigned int
 DialogGetReconstructionParameters::getInterpParam ()
 {
+#if HAVE_FREQ_PREINTERP
   wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
   unsigned long lValue;
   if (strCtrl.ToULong (&lValue))
     return lValue;
   else
     return (m_iDefaultInterpParam);
+#else
+  return 1;
+#endif
 }
 
 double
@@ -838,13 +868,24 @@ DialogGetReconstructionParameters::getTrace ()
 const char*
 DialogGetReconstructionParameters::getBackprojectName ()
 {
-  return m_pListBoxBackproject->getSelectionStringValue();
+  if (theApp->getAdvancedOptions()) {
+    return m_pListBoxBackproject->getSelectionStringValue();
+  } else
+    return "idiff";
 }
 
 const char*
 DialogGetReconstructionParameters::getFilterGenerationName ()
 {
-  return m_pListBoxFilterGeneration->getSelectionStringValue();
+  if (theApp->getAdvancedOptions()) {
+    return m_pListBoxFilterGeneration->getSelectionStringValue();
+  } else {
+    if (ProcessSignal::convertFilterMethodNameToID(m_pListBoxFilterMethod->getSelectionStringValue())
+        == ProcessSignal::FILTER_METHOD_CONVOLUTION)
+      return "direct";
+    else
+      return "inverse-fourier";
+  }
 }