r187: *** empty log message ***
[ctsim.git] / src / dialogs.cpp
index a3c27f748a43c760b6a533d137158693d181c8f0..3035244e912e1e572109266e4620886f9a400f31 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dialogs.cpp,v 1.10 2000/08/27 20:32:55 kevin Exp $
+**  $Id: dialogs.cpp,v 1.12 2000/09/02 05:10:39 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
@@ -280,7 +280,7 @@ DialogGetRasterParameters::getNSamples (void)
 /////////////////////////////////////////////////////////////////////
 
 
-DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet = 0, int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., double dDefaultFocalLength = 1, double dDefaultFieldOfView = 1., int iDefaultGeometry = Scanner::GEOMETRY_PARALLEL, int iDefaultTrace = Trace::TRACE_NONE)
+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)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
@@ -292,13 +292,15 @@ DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent,
   m_iDefaultNView = iDefaultNView;
   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);
 
   m_pListBoxGeometry = new StringValueAndTitleListBox (this, Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
-  m_pListBoxGeometry->SetSelection (iDefaultGeometry);
+  m_pListBoxGeometry->SetSelection (iDefaultGeometry, true);
 
   ostringstream os;
   os << iDefaultNDet;
@@ -456,7 +458,7 @@ DialogGetProjectionParameters::getTrace (void)
 /////////////////////////////////////////////////////////////////////
 
 
-DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultFilterID = SignalFilter::FILTER_ABS_BANDLIMIT, double dDefaultFilterParam = 1.,  int iDefaultFilterMethodID = ProcessSignal::FILTER_METHOD_CONVOLUTION, int iDefaultFilterGenerationID = ProcessSignal::FILTER_GENERATION_INVALID, int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR, int iDefaultInterpParam = 1, int iDefaultBackprojectID = Backprojector::BPROJ_IDIFF3)
+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)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
@@ -521,6 +523,10 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* p
   pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
 
+  m_pListBoxTrace = new StringValueAndTitleListBox (this, Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
+  m_pListBoxTrace->SetSelection (iTrace);
+  pTopSizer->Add (m_pListBoxTrace);
+
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
 
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
@@ -617,6 +623,12 @@ DialogGetReconstructionParameters::getInterpName (void)
   return m_pListBoxInterp->getSelectionStringValue();
 }
 
+int
+DialogGetReconstructionParameters::getTrace (void)
+{
+  return Trace::convertTraceNameToID(m_pListBoxTrace->getSelectionStringValue());
+}
+
 const char*
 DialogGetReconstructionParameters::getBackprojectName (void)
 {
@@ -630,7 +642,7 @@ DialogGetReconstructionParameters::getFilterGenerationName (void)
 }
 
 
-DialogAutoScaleParameters::DialogAutoScaleParameters (wxFrame *pParent, const ImageFile& rIF)
+DialogAutoScaleParameters::DialogAutoScaleParameters (wxFrame *pParent, const ImageFile& rIF, double dDefaultScaleFactor)
   : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rImageFile(rIF)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
@@ -650,7 +662,9 @@ DialogAutoScaleParameters::DialogAutoScaleParameters (wxFrame *pParent, const Im
 
   wxGridSizer *pGridSizer = new wxGridSizer (2);
   pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
-  m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, "1.0", wxDefaultPosition, wxSize(100, 25), 0);
+  ostringstream osDefaultFactor;
+  osDefaultFactor << dDefaultScaleFactor;
+  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);
 
@@ -694,3 +708,15 @@ DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
   *pMax = dCenter + dHalfWidth;
   *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
 }
+
+double
+DialogAutoScaleParameters::getAutoScaleFactor ()
+{
+  wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
+  double dValue = 1.;
+  if (! sStddevFactor.ToDouble (&dValue)) {
+    *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
+  }
+
+  return dValue;
+}