** 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.30 2001/02/11 21:57:08 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
}
+/////////////////////////////////////////////////////////////////////
+// CLASS DiaglogPreferences Implementation
+/////////////////////////////////////////////////////////////////////
+
+DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle,
+ bool bAdvancedOptions, bool bAskDeleteNewDocs)
+: 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);
+
+ m_pCBAdvancedOptions = new wxCheckBox (this, -1, "", wxDefaultPosition, wxSize(100, 25), 0);
+ m_pCBAdvancedOptions->SetValue (bAdvancedOptions);
+
+ m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "", wxDefaultPosition, wxSize(100, 25), 0);
+ m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
+
+ wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
+ pGridSizer->Add (m_pCBAdvancedOptions, 0, wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (new wxStaticText (this, -1, "Show Advanced Options"), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (new wxStaticText (this, -1, "Ask Save New Documents Before Closing"), 0, wxALIGN_LEFT | 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);
+ pTopSizer->SetSizeHints (this);
+}
+
+DialogPreferences::~DialogPreferences ()
+{
+}
+
+bool
+DialogPreferences::getAdvancedOptions ()
+{
+ return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
+}
+
+bool
+DialogPreferences::getAskDeleteNewDocs ()
+{
+ return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
+}
+
+
/////////////////////////////////////////////////////////////////////
// CLASS DiaglogGetMinMax Implementation
/////////////////////////////////////////////////////////////////////
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);
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
/////////////////////////////////////////////////////////////////////
-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);
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);
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);
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);
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
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";
+ }
}