+
+ 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[] = {"Mode", "Median", "Mean"};
+
+ m_pRadioBoxCenter = new wxRadioBox (this, -1, _T("Center"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
+ m_pRadioBoxCenter->SetSelection (0);
+ pTopSizer->Add (m_pRadioBoxCenter, 0, wxALL | wxALIGN_CENTER);
+
+ wxGridSizer *pGridSizer = new wxGridSizer (2);
+ pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ std::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");
+ pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+ wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+ pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+ CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_AUTOSCALE);
+ pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
+
+ pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+ pButtonOk->SetDefault();
+
+ SetAutoLayout (true);
+ SetSizer (pTopSizer);
+ pTopSizer->Fit (this);
+ pTopSizer->SetSizeHints (this);
+}
+
+bool
+DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
+{
+ int iCenter = m_pRadioBoxCenter->GetSelection();
+ double dCenter = m_dMode;
+ if (iCenter == 1)
+ dCenter = m_dMedian;
+ else if (iCenter == 2)
+ dCenter = m_dMean;
+
+ wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
+ double dValue;
+ if (! sStddevFactor.ToDouble (&dValue)) {
+ *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
+ return false;
+ }
+ double dHalfWidth = dValue * m_dStdDev / 2;
+ *pMin = dCenter - dHalfWidth;
+ *pMax = dCenter + dHalfWidth;
+ *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
+
+ return true;
+}
+
+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;
+}
+
+
+
+/////////////////////////////////////////////////////////////////////
+// CLASS IDENTIFICATION
+//
+// DialogGetRasterParameters
+/////////////////////////////////////////////////////////////////////
+
+DialogGetRasterParameters::DialogGetRasterParameters
+ (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
+: wxDialog (pParent, -1, _T("Set Rasterization Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+{
+ wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+
+ pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
+
+ pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+
+ wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
+ 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_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_CENTER_VERTICAL);
+ std::ostringstream osViewRatio;
+ osViewRatio << dDefaultViewRatio;
+ m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
+ std::ostringstream osNSamples;
+ osNSamples << iDefaultNSamples;
+ m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlNSamples, 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");
+ pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+ wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+ pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+ CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RASTERIZE);
+ pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
+
+ pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+ pButtonOk->SetDefault();
+
+ SetAutoLayout (true);
+ SetSizer (pTopSizer);
+ pTopSizer->Fit (this);
+ pTopSizer->SetSizeHints (this);
+}
+
+DialogGetRasterParameters::~DialogGetRasterParameters ()
+{
+}
+
+
+unsigned int
+DialogGetRasterParameters::getXSize ()
+{
+ wxString strCtrl = m_pTextCtrlXSize->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultXSize);
+}
+
+unsigned int
+DialogGetRasterParameters::getYSize ()
+{
+ wxString strCtrl = m_pTextCtrlYSize->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultYSize);
+}
+
+unsigned int
+DialogGetRasterParameters::getNSamples ()
+{
+ wxString strCtrl = m_pTextCtrlNSamples->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultNSamples);
+}
+
+double
+DialogGetRasterParameters::getViewRatio ()
+{
+ wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
+ double dValue;
+ if (strCtrl.ToDouble (&dValue))
+ return dValue;
+ else
+ return (m_dDefaultViewRatio);
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// CLASS IDENTIFICATION
+//
+// DialogGetProjectionParameters
+/////////////////////////////////////////////////////////////////////
+
+
+DialogGetProjectionParameters::DialogGetProjectionParameters
+ (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples,
+ double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultCenterDetectorLength,
+ double dDefaultViewRatio, double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
+: wxDialog (pParent, -1, _T("Set Projection Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+{
+ wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+
+ m_dDefaultRotAngle = dDefaultRotAngle;
+ m_dDefaultFocalLength = dDefaultFocalLength;
+ m_dDefaultCenterDetectorLength = dDefaultCenterDetectorLength;
+ m_dDefaultViewRatio = dDefaultViewRatio;
+ m_dDefaultScanRatio = dDefaultScanRatio;
+ m_iDefaultNSamples = iDefaultNSamples;
+ 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);
+
+ wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
+ m_pRadioBoxGeometry = new StringValueAndTitleRadioBox (this, _T("Geometry"), Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
+ m_pRadioBoxGeometry->SetSelection (iDefaultGeometry);
+
+ pGridSizer->Add (m_pRadioBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+
+ m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
+ m_pRadioBoxTrace->SetSelection (iDefaultTrace);
+ pGridSizer->Add (m_pRadioBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+
+ wxFlexGridSizer* pText1Sizer = new wxFlexGridSizer(2);
+ std::ostringstream os;
+ os << iDefaultNDet;
+ m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pText1Sizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pText1Sizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
+ std::ostringstream osNView;
+ osNView << iDefaultNView;
+ m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pText1Sizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pText1Sizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
+ std::ostringstream osNSamples;
+ osNSamples << iDefaultNSamples;
+ m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pText1Sizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pText1Sizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
+
+ pGridSizer->Add (pText1Sizer);
+
+ wxFlexGridSizer* pText2Sizer = new wxFlexGridSizer(2);
+ std::ostringstream osViewRatio;
+ osViewRatio << dDefaultViewRatio;
+ m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pText2Sizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pText2Sizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
+ std::ostringstream osScanRatio;
+ osScanRatio << dDefaultScanRatio;
+ m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pText2Sizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pText2Sizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
+ std::ostringstream osFocalLength;
+ osFocalLength << dDefaultFocalLength;
+ m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pText2Sizer->Add (m_pTextCtrlFocalLength, 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);
+ pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (Fraction of circle)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pText2Sizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
+ }
+ pGridSizer->Add (pText2Sizer);
+
+ 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");
+ pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+ wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+ pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+ CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PROJECTIONS);
+ pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
+
+ pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+ pButtonOk->SetDefault();
+
+ SetAutoLayout (true);
+ SetSizer (pTopSizer);
+ pTopSizer->Fit (this);
+ pTopSizer->SetSizeHints (this);
+
+ m_pRadioBoxGeometry->SetFocus();
+}
+
+DialogGetProjectionParameters::~DialogGetProjectionParameters ()
+{
+}
+
+
+unsigned int
+DialogGetProjectionParameters::getNDet ()
+{
+ wxString strCtrl = m_pTextCtrlNDet->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultNDet);
+}
+
+unsigned int
+DialogGetProjectionParameters::getNView ()
+{
+ wxString strCtrl = m_pTextCtrlNView->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultNView);
+}
+
+
+unsigned int
+DialogGetProjectionParameters::getNSamples ()
+{
+ wxString strCtrl = m_pTextCtrlNSamples->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultNSamples);
+}
+
+double
+DialogGetProjectionParameters::getRotAngle ()
+{
+ if (theApp->getAdvancedOptions()) {
+ wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
+ double dValue;
+ if (strCtrl.ToDouble (&dValue))
+ return (dValue * TWOPI);
+ else
+ return (m_dDefaultRotAngle);
+ } else {
+ if (Scanner::convertGeometryNameToID (m_pRadioBoxGeometry->getSelectionStringValue()) ==
+ Scanner::GEOMETRY_PARALLEL)
+ return (PI);
+ else
+ return (TWOPI);
+ }
+}
+
+double
+DialogGetProjectionParameters::getFocalLengthRatio ()
+{
+ wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
+ double dValue;
+ if (strCtrl.ToDouble (&dValue))
+ return (dValue);
+ else
+ return (m_dDefaultFocalLength);
+}
+
+double
+DialogGetProjectionParameters::getCenterDetectorLengthRatio ()
+{
+ 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
+DialogGetProjectionParameters::getViewRatio ()
+{
+ wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
+ double dValue;
+ if (strCtrl.ToDouble (&dValue))
+ return (dValue);
+ else
+ return (m_dDefaultViewRatio);
+}
+
+double
+DialogGetProjectionParameters::getScanRatio ()
+{
+ wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
+ double dValue;
+ if (strCtrl.ToDouble (&dValue))
+ return (dValue);
+ else
+ return (m_dDefaultScanRatio);
+}
+
+const char*
+DialogGetProjectionParameters::getGeometry ()
+{
+ return m_pRadioBoxGeometry->getSelectionStringValue();
+}
+
+int
+DialogGetProjectionParameters::getTrace ()
+{
+ return Trace::convertTraceNameToID(m_pRadioBoxTrace->getSelectionStringValue());
+}
+
+
+
+/////////////////////////////////////////////////////////////////////
+// CLASS IDENTIFICATION
+//
+// DialogGetReconstructionParameters
+/////////////////////////////////////////////////////////////////////
+
+
+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,
+ 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;