- const Phantom& rPhantom = GetDocument()->getPhantom();
- ProjectionFileDocument* pProjectionDoc = dynamic_cast<ProjectionFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.pj", wxDOC_SILENT));
- Projections& rProj = pProjectionDoc->getProjections();
- Scanner theScanner (rPhantom, "parallel", 367, 320, 2, PI);
- rProj.initFromScanner (theScanner);
- theScanner.collectProjections (rProj, rPhantom, 0, TRACE_NONE);
- pProjectionDoc->Modify(true);
- pProjectionDoc->UpdateAllViews(this);
+ DialogGetProjectionParameters dialogProjection (m_frame, 367, 320, 1, 1., 1., 1., Scanner::GEOMETRY_PARALLEL, Trace::TRACE_NONE);
+ int retVal = dialogProjection.ShowModal();
+ if (retVal == wxID_OK) {
+ int nDet = dialogProjection.getNDet();
+ int nView = dialogProjection.getNView();
+ int nSamples = dialogProjection.getNSamples();
+ int iTrace = dialogProjection.getTrace();
+ double dRotAngle = dialogProjection.getRotAngle();
+ double dFocalLengthRatio = dialogProjection.getFocalLengthRatio();
+ double dFieldOfViewRatio = dialogProjection.getFieldOfViewRatio();
+
+ wxString sGeometry = dialogProjection.getGeometry();
+ if (nDet > 0 && nView > 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(), nDet, nView, nSamples, dRotAngle, dFocalLengthRatio, dFieldOfViewRatio);
+ if (theScanner.fail()) {
+ *theApp->getLog() << "Failed making scanner: " << theScanner.failMessage().c_str() << "\n";
+ return;
+ }
+ rProj.initFromScanner (theScanner);
+
+ if (iTrace > Trace::TRACE_CONSOLE) {
+ ProjectionsDialog dialogProjections (theScanner, rProj, rPhantom, iTrace, 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
+ theScanner.collectProjections (rProj, rPhantom, iTrace);
+
+ pProjectionDoc->Modify(true);
+ pProjectionDoc->UpdateAllViews(this);
+ if (wxView* pView = pProjectionDoc->GetFirstView())
+ if (wxFrame* pFrame = pView->GetFrame()) {
+ pFrame->SetFocus();
+ }
+ ostringstream os;
+ os << "Projections for " << rPhantom.name() << ": nDet=" << nDet << ", nView=" << nView << ", nSamples=" << nSamples << ", RotAngle=" << dRotAngle << ", FocalLengthRatio=" << dFocalLengthRatio << ", FieldOfViewRatio=" << dFieldOfViewRatio << ", Geometry=" << sGeometry.c_str() << "\n";
+ rProj.setRemark (os.str());
+ *theApp->getLog() << os.str().c_str();
+ }
+ }