- DialogGetProjectionParameters dialogProjection (m_frame, m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation, m_dDefaultFocalLength, m_dDefaultFieldOfView, m_iDefaultGeometry, m_iDefaultTrace);
- int retVal = dialogProjection.ShowModal();
- 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_dDefaultFieldOfView = dialogProjection.getFieldOfViewRatio();
- wxString sGeometry = dialogProjection.getGeometry();
- m_iDefaultGeometry = Scanner::convertGeometryNameToID (sGeometry.c_str());
-
- if (m_iDefaultNDet > 0 && m_iDefaultNView > 0 && sGeometry != "") {
- const Phantom& rPhantom = GetDocument()->getPhantom();
- ProjectionFileDocument* pProjectionDoc = dynamic_cast<ProjectionFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.pj", wxDOC_SILENT));
- Projections& rProj = pProjectionDoc->getProjections();
- Scanner theScanner (rPhantom, sGeometry.c_str(), m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation, m_dDefaultFocalLength, m_dDefaultFieldOfView);
- if (theScanner.fail()) {
- *theApp->getLog() << "Failed making scanner: " << theScanner.failMessage().c_str() << "\n";
- return;
- }
- rProj.initFromScanner (theScanner);
- m_dDefaultRotation /= PI; // convert back to PI units
-
- if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
- ProjectionsDialog dialogProjections (theScanner, rProj, rPhantom, m_iDefaultTrace, dynamic_cast<wxWindow*>(m_frame));
- for (int iView = 0; iView < rProj.nView(); iView++) {
- ::wxYield();
- ::wxYield();
- if (dialogProjections.isCancelled() || ! dialogProjections.projectView (iView)) {
- pProjectionDoc->DeleteAllViews();
- return;
- }
- ::wxYield();
- ::wxYield();
- while (dialogProjections.isPaused()) {
- ::wxYield();
- ::wxUsleep(50);
- }
- }
- } else {
- wxProgressDialog dlgProgress (wxString("Projection"), wxString("Projection Progress"), rProj.nView() + 1, m_frame, wxPD_CAN_ABORT);
- for (int i = 0; i < rProj.nView(); i++) {
- theScanner.collectProjections (rProj, rPhantom, i, 1, true, m_iDefaultTrace);
- if (! dlgProgress.Update (i+1)) {
- pProjectionDoc->DeleteAllViews();
- return;
- }
- }
- }
-
- std::ostringstream os;
- os << "Projections for " << rPhantom.name() << ": nDet=" << m_iDefaultNDet << ", nView=" << m_iDefaultNView << ", nSamples=" << m_iDefaultNSample << ", RotAngle=" << m_dDefaultRotation << ", FocalLengthRatio=" << m_dDefaultFocalLength << ", FieldOfViewRatio=" << m_dDefaultFieldOfView << ", Geometry=" << sGeometry.c_str();
- rProj.setRemark (os.str());
- *theApp->getLog() << os.str().c_str() << "\n";
-
- m_frame->Lower();
- ::wxYield();
- ProjectionFileView* projView = dynamic_cast<ProjectionFileView*>(pProjectionDoc->GetFirstView());\r
- if (projView) {\r
- projView->getFrame()->SetFocus();\r
- projView->OnUpdate (projView, NULL);\r
- }\r
- if (wxView* pView = pProjectionDoc->GetFirstView()) {
- if (wxFrame* pFrame = pView->GetFrame()) {
- pFrame->SetFocus();
- pFrame->Raise();
- }
- theApp->getDocManager()->ActivateView (pView, true, false);
- }
- ::wxYield();
- pProjectionDoc->Modify(true);
- pProjectionDoc->UpdateAllViews(this);
- }
- }
+ DialogGetProjectionParameters dialogProjection (m_frame, m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation, m_dDefaultFocalLength, m_dDefaultFieldOfView, m_iDefaultGeometry, m_iDefaultTrace);
+ int retVal = dialogProjection.ShowModal();
+ 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_dDefaultFieldOfView = dialogProjection.getFieldOfViewRatio();
+ wxString sGeometry = dialogProjection.getGeometry();
+ m_iDefaultGeometry = Scanner::convertGeometryNameToID (sGeometry.c_str());
+
+ if (m_iDefaultNDet > 0 && m_iDefaultNView > 0 && sGeometry != "") {
+ const Phantom& rPhantom = GetDocument()->getPhantom();
+ ProjectionFileDocument* pProjectionDoc = dynamic_cast<ProjectionFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.pj", wxDOC_SILENT));\r
+ if (! pProjectionDoc) {\r
+ sys_error (ERR_SEVERE, "Unable to create projection document");\r
+ return;\r
+ }
+ Projections& rProj = pProjectionDoc->getProjections();
+ Scanner theScanner (rPhantom, sGeometry.c_str(), m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation, m_dDefaultFocalLength, m_dDefaultFieldOfView);
+ if (theScanner.fail()) {
+ *theApp->getLog() << "Failed making scanner: " << theScanner.failMessage().c_str() << "\n";
+ return;
+ }
+ rProj.initFromScanner (theScanner);
+ m_dDefaultRotation /= PI; // convert back to PI units
+
+ if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
+ ProjectionsDialog dialogProjections (theScanner, rProj, rPhantom, m_iDefaultTrace, dynamic_cast<wxWindow*>(m_frame));
+ for (int iView = 0; iView < rProj.nView(); iView++) {
+ ::wxYield();
+ ::wxYield();
+ if (dialogProjections.isCancelled() || ! dialogProjections.projectView (iView)) {
+ pProjectionDoc->DeleteAllViews();
+ return;
+ }
+ ::wxYield();
+ ::wxYield();
+ while (dialogProjections.isPaused()) {
+ ::wxYield();
+ ::wxUsleep(50);
+ }
+ }
+ } else {
+ wxProgressDialog dlgProgress (wxString("Projection"), wxString("Projection Progress"), rProj.nView() + 1, m_frame, wxPD_CAN_ABORT);
+ for (int i = 0; i < rProj.nView(); i++) {
+ theScanner.collectProjections (rProj, rPhantom, i, 1, true, m_iDefaultTrace);
+ if (! dlgProgress.Update (i+1)) {
+ pProjectionDoc->DeleteAllViews();
+ return;
+ }
+ }
+ }
+
+ std::ostringstream os;
+ os << "Projections for " << rPhantom.name() << ": nDet=" << m_iDefaultNDet << ", nView=" << m_iDefaultNView << ", nSamples=" << m_iDefaultNSample << ", RotAngle=" << m_dDefaultRotation << ", FocalLengthRatio=" << m_dDefaultFocalLength << ", FieldOfViewRatio=" << m_dDefaultFieldOfView << ", Geometry=" << sGeometry.c_str();
+ rProj.setRemark (os.str());
+ *theApp->getLog() << os.str().c_str() << "\n";
+
+ m_frame->Lower();
+ ::wxYield();
+ ProjectionFileView* projView = dynamic_cast<ProjectionFileView*>(pProjectionDoc->GetFirstView());\r
+ if (projView) {\r
+ projView->getFrame()->SetFocus();\r
+ projView->OnUpdate (projView, NULL);\r
+ }\r
+ if (wxView* pView = pProjectionDoc->GetFirstView()) {
+ if (wxFrame* pFrame = pView->GetFrame()) {
+ pFrame->SetFocus();
+ pFrame->Raise();
+ }
+ theApp->getDocManager()->ActivateView (pView, true, false);
+ }
+ ::wxYield();
+ if (theApp->getSetModifyNewDocs())\r
+ pProjectionDoc->Modify(true);
+ pProjectionDoc->UpdateAllViews(this);
+ }
+ }