** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: dialogs.cpp,v 1.49 2001/03/11 12:37:34 kevin Exp $
+** $Id: dialogs.cpp,v 1.50 2001/03/11 15:27:30 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
pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
pText2Sizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
- std::ostringstream osCenterDetectorLength;
- osCenterDetectorLength << dDefaultCenterDetectorLength;
- m_pTextCtrlCenterDetectorLength = new wxTextCtrl (this, -1, osCenterDetectorLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
- pText2Sizer->Add (new wxStaticText (this, -1, "Center-Detector Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
- pText2Sizer->Add (m_pTextCtrlCenterDetectorLength, 0, wxALIGN_CENTER_VERTICAL);
-
if (theApp->getAdvancedOptions()) {
+ std::ostringstream osCenterDetectorLength;
+ osCenterDetectorLength << dDefaultCenterDetectorLength;
+ m_pTextCtrlCenterDetectorLength = new wxTextCtrl (this, -1, osCenterDetectorLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pText2Sizer->Add (new wxStaticText (this, -1, "Center-Detector Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pText2Sizer->Add (m_pTextCtrlCenterDetectorLength, 0, wxALIGN_CENTER_VERTICAL);
+
std::ostringstream osRotAngle;
osRotAngle << dDefaultRotAngle;
m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
double
DialogGetProjectionParameters::getCenterDetectorLengthRatio ()
{
- wxString strCtrl = m_pTextCtrlCenterDetectorLength->GetValue();
- double dValue;
- if (strCtrl.ToDouble (&dValue))
- return (dValue);
- else
- return (m_dDefaultCenterDetectorLength);
+ if (theApp->getAdvancedOptions()) {
+ wxString strCtrl = m_pTextCtrlCenterDetectorLength->GetValue();
+ double dValue;
+ if (strCtrl.ToDouble (&dValue))
+ return (dValue);
+ else
+ return (m_dDefaultCenterDetectorLength);
+ } else
+ return getFocalLengthRatio(); // default is to set equal to focal-length
}
double
DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize,
int iDefaultYSize, int iDefaultFilterID, double dDefaultHammingParam,
int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad,
- int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
+ int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace,
+ ReconstructionROI* pDefaultROI)
: wxDialog (pParent, -1, _T("Set Reconstruction Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+ m_iDefaultXSize = iDefaultXSize;
+ m_iDefaultYSize = iDefaultYSize;
+ m_dDefaultFilterParam = dDefaultHammingParam;
+ m_iDefaultZeropad = iDefaultZeropad;
+ m_iDefaultInterpParam = iDefaultInterpParam;
+ m_dDefaultRoiXMin = pDefaultROI->m_dXMin;
+ m_dDefaultRoiXMax = pDefaultROI->m_dXMax;
+ m_dDefaultRoiYMin = pDefaultROI->m_dYMin;
+ m_dDefaultRoiYMax = pDefaultROI->m_dYMax;
+
pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
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
-
+
+ if (theApp->getAdvancedOptions()) {
+ wxFlexGridSizer* pROIGridSizer = new wxFlexGridSizer (2);
+ std::ostringstream osRoiXMin;
+ osRoiXMin << m_dDefaultRoiXMin;
+ m_pTextCtrlRoiXMin = new wxTextCtrl (this, -1, osRoiXMin.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pROIGridSizer->Add (new wxStaticText (this, -1, "ROI XMin"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pROIGridSizer->Add (m_pTextCtrlRoiXMin, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+ std::ostringstream osRoiXMax;
+ osRoiXMax << m_dDefaultRoiXMax;
+ m_pTextCtrlRoiXMax = new wxTextCtrl (this, -1, osRoiXMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pROIGridSizer->Add (new wxStaticText (this, -1, "ROI XMax"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pROIGridSizer->Add (m_pTextCtrlRoiXMax, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+ std::ostringstream osRoiYMin;
+ osRoiYMin << m_dDefaultRoiYMin;
+ m_pTextCtrlRoiYMin = new wxTextCtrl (this, -1, osRoiYMin.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pROIGridSizer->Add (new wxStaticText (this, -1, "ROI YMin"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pROIGridSizer->Add (m_pTextCtrlRoiYMin, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+ std::ostringstream osRoiYMax;
+ osRoiYMax << m_dDefaultRoiYMax;
+ m_pTextCtrlRoiYMax = new wxTextCtrl (this, -1, osRoiYMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pROIGridSizer->Add (new wxStaticText (this, -1, "ROI YMax"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pROIGridSizer->Add (m_pTextCtrlRoiYMax, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+
+ pGridSizer->Add (pROIGridSizer);
+ }
+
pTopSizer->Add (pGridSizer, 1, wxALL, 3);
pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
}
}
+void
+DialogGetReconstructionParameters::getROI (ReconstructionROI* pROI)
+{
+ if (theApp->getAdvancedOptions()) {
+ double dValue;
+ if (m_pTextCtrlRoiXMin->GetValue().ToDouble (&dValue))
+ pROI->m_dXMin = dValue;
+ else
+ pROI->m_dXMin = m_dDefaultRoiXMin;
+
+ if (m_pTextCtrlRoiXMax->GetValue().ToDouble (&dValue))
+ pROI->m_dXMax = dValue;
+ else
+ pROI->m_dXMax = m_dDefaultRoiXMax;
+
+ if (m_pTextCtrlRoiYMin->GetValue().ToDouble (&dValue))
+ pROI->m_dYMin = dValue;
+ else
+ pROI->m_dYMin = m_dDefaultRoiYMin;
+
+ if (m_pTextCtrlRoiYMax->GetValue().ToDouble (&dValue))
+ pROI->m_dYMax = dValue;
+ else
+ pROI->m_dYMax = m_dDefaultRoiYMax;
+ } else {
+ pROI->m_dXMin = m_dDefaultRoiXMin;
+ pROI->m_dXMax = m_dDefaultRoiXMax;
+ pROI->m_dYMin = m_dDefaultRoiYMin;
+ pROI->m_dYMax = m_dDefaultRoiYMax;
+ }
+}
/////////////////////////////////////////////////////////////////////
// CLASS IDENTIFICATION