+
+const char*
+DialogGetReconstructionParameters::getFilterGenerationName (void)
+{
+ return m_pListBoxFilterGeneration->getSelectionStringValue();
+}
+
+
+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);
+
+ 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);
+ 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);
+
+ 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);
+}
+
+void
+DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
+{
+ int iCenter = m_pListBoxCenter->GetSelection();
+ double min, max, mean, mode, median, stddev;
+ m_rImageFile.statistics (min, max, mean, mode, median, stddev);
+ double dCenter = median;
+ if (iCenter == 1)
+ dCenter = mode;
+ else if (iCenter == 2)
+ dCenter = mean;
+
+ wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
+ double dValue;
+ if (! sStddevFactor.ToDouble (&dValue)) {
+ *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
+ *pMin = min;
+ *pMax = max;
+ }
+ double dHalfWidth = dValue * stddev / 2;
+ *pMin = dCenter - dHalfWidth;
+ *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;
+}