X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fdialogs.cpp;h=b4811ed1faeb74aff28170b42c981a63f9df90e4;hp=97c68adeda4a1ca407c0a17bec81a7872e8b7f04;hb=de411914da8b157958e9caae917bf1edeafbb713;hpb=758774f7a87d488faa7412a04d07e4cce140b66c diff --git a/src/dialogs.cpp b/src/dialogs.cpp index 97c68ad..b4811ed 100644 --- a/src/dialogs.cpp +++ b/src/dialogs.cpp @@ -9,7 +9,7 @@ ** 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 @@ -648,13 +648,13 @@ DialogGetProjectionParameters::DialogGetProjectionParameters 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); @@ -758,12 +758,15 @@ DialogGetProjectionParameters::getFocalLengthRatio () 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 @@ -812,11 +815,22 @@ DialogGetProjectionParameters::getTrace () 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); @@ -909,7 +923,33 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* 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); @@ -1050,6 +1090,37 @@ DialogGetReconstructionParameters::getFilterGenerationName () } } +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