- if (retVal == wxID_OK) {
- m_iDefaultNDet = dialogProjection.getNDet();
- m_iDefaultNView = dialogProjection.getNView();
- m_iDefaultNSample = dialogProjection.getNSamples();
- m_iDefaultTrace = dialogProjection.getTrace();
- m_dDefaultRotation = dialogProjection.getRotAngle();
- m_dDefaultFocalLength = dialogProjection.getFocalLengthRatio();
- m_dDefaultViewRatio = dialogProjection.getViewRatio();
- m_dDefaultScanRatio = dialogProjection.getScanRatio();
- wxString sGeometry = dialogProjection.getGeometry();
- m_iDefaultGeometry = Scanner::convertGeometryNameToID (sGeometry.c_str());
-
- if (m_iDefaultNDet > 0 && m_iDefaultNView > 0 && sGeometry != "") {
- const Phantom& rPhantom = GetDocument()->getPhantom();
- Projections* pProj = new Projections;
- Scanner theScanner (rPhantom, sGeometry.c_str(), m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample,
- m_dDefaultRotation, m_dDefaultFocalLength, m_dDefaultViewRatio, m_dDefaultScanRatio);
- if (theScanner.fail()) {
- wxString msg = "Failed making scanner\n";
- msg += theScanner.failMessage().c_str();
- *theApp->getLog() << msg << "\n";
- wxMessageBox (msg, "Error");
- return;
- }
- pProj->initFromScanner (theScanner);
- m_dDefaultRotation /= TWOPI; // convert back to fraction of a circle
-
- Timer timer;
- if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
- ProjectionsDialog dialogProjections (theScanner, *pProj, rPhantom, m_iDefaultTrace, dynamic_cast<wxWindow*>(getFrameForChild()));
- for (int iView = 0; iView < pProj->nView(); iView++) {
- ::wxYield();
- if (dialogProjections.isCancelled() || ! dialogProjections.projectView (iView)) {
- delete pProj;
- return;
- }
- ::wxYield();
- while (dialogProjections.isPaused()) {
- ::wxYield();
- ::wxUsleep(50);
- }
- }
- } else {
- wxProgressDialog dlgProgress (wxString("Projection"), wxString("Projection Progress"), pProj->nView() + 1, getFrameForChild(), wxPD_CAN_ABORT );
- for (int i = 0; i < pProj->nView(); i++) {
- theScanner.collectProjections (*pProj, rPhantom, i, 1, true, m_iDefaultTrace);
- if (! dlgProgress.Update (i+1)) {
- delete pProj;
- return;
- }
- }
+ if (retVal != wxID_OK)
+ return;
+
+ m_iDefaultNDet = dialogProjection.getNDet();
+ m_iDefaultNView = dialogProjection.getNView();
+ m_iDefaultOffsetView = dialogProjection.getOffsetView();
+ m_iDefaultNSample = dialogProjection.getNSamples();
+ m_iDefaultTrace = dialogProjection.getTrace();
+ m_dDefaultRotation = dialogProjection.getRotAngle();
+ m_dDefaultFocalLength = dialogProjection.getFocalLengthRatio();
+ m_dDefaultCenterDetectorLength = dialogProjection.getCenterDetectorLengthRatio();
+ m_dDefaultViewRatio = dialogProjection.getViewRatio();
+ m_dDefaultScanRatio = dialogProjection.getScanRatio();
+ wxString sGeometry = dialogProjection.getGeometry();
+ m_iDefaultGeometry = Scanner::convertGeometryNameToID (sGeometry.c_str());
+ double dRotationRadians = m_dDefaultRotation;
+ m_dDefaultRotation /= TWOPI; // convert back to fraction of a circle
+
+ if (m_iDefaultNDet <= 0 || m_iDefaultNView <= 0 || sGeometry == "")
+ return;
+
+ const Phantom& rPhantom = GetDocument()->getPhantom();
+ Scanner theScanner (rPhantom, sGeometry.c_str(), m_iDefaultNDet, m_iDefaultNView, m_iDefaultOffsetView, m_iDefaultNSample,
+ dRotationRadians, m_dDefaultFocalLength, m_dDefaultCenterDetectorLength, m_dDefaultViewRatio, m_dDefaultScanRatio);
+ if (theScanner.fail()) {
+ wxString msg = "Failed making scanner\n";
+ msg += theScanner.failMessage().c_str();
+ *theApp->getLog() << msg << "\n";
+ wxMessageBox (msg, "Error");
+ return;
+ }
+
+ std::ostringstream os;
+ os << "Projections for " << rPhantom.name()
+ << ": nDet=" << m_iDefaultNDet
+ << ", nView=" << m_iDefaultNView
+ << ", gantry offset=" << m_iDefaultOffsetView
+ << ", nSamples=" << m_iDefaultNSample
+ << ", RotAngle=" << m_dDefaultRotation
+ << ", FocalLengthRatio=" << m_dDefaultFocalLength
+ << ", CenterDetectorLengthRatio=" << m_dDefaultCenterDetectorLength
+ << ", ViewRatio=" << m_dDefaultViewRatio
+ << ", ScanRatio=" << m_dDefaultScanRatio
+ << ", Geometry=" << sGeometry.c_str()
+ << ", FanBeamAngle=" << convertRadiansToDegrees (theScanner.fanBeamAngle());
+
+ Timer timer;
+ Projections* pProj = NULL;
+ if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
+ pProj = new Projections;
+ pProj->initFromScanner (theScanner);
+
+ ProjectionsDialog dialogProjections (theScanner, *pProj, rPhantom, m_iDefaultTrace, dynamic_cast<wxWindow*>(getFrameForChild()));
+ for (int iView = 0; iView < pProj->nView(); iView++) {
+ ::wxYield();
+ if (dialogProjections.isCancelled() || ! dialogProjections.projectView (iView)) {
+ delete pProj;
+ return;