- 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);
+ int retVal = dialogProjection.ShowModal();
+ if (retVal == wxID_OK) {
+ int nDet = dialogProjection.getNDet();
+ int nView = dialogProjection.getNView();
+ int nSamples = dialogProjection.getNSamples();
+ 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 1
+ wxFrame frame (m_frame, -1, "", wxDefaultPosition, wxSize(500,500));
+ frame.Show();
+ wxClientDC dc (&frame);
+ int x, y;
+ frame.GetClientSize(&x, &y);
+ SGPDriver driver (dynamic_cast<wxDC*>(&dc), x, y);
+ SGP sgp (driver);
+ for (int iView = 0; iView < rProj.nView(); iView++) {
+ theScanner.collectProjections (rProj, rPhantom, iView, 1, true, TRACE_RAYS, &sgp);
+ }
+#else
+ theScanner.collectProjections (rProj, rPhantom);
+#endif
+
+ pProjectionDoc->Modify(true);
+ pProjectionDoc->UpdateAllViews(this);
+ ostringstream os;
+ os << "Projections for " << rPhantom.name() << ": nDet=" << nDet << ", nView=" << nView << ", nSamples=" << nSamples << ", RotAngle=" << dRotAngle << ", FocalLengthRatio=" << dFocalLengthRatio << ", FieldOfViewRatio=" << dFieldOfViewRatio << ", Geometry=" << sGeometry.c_str() << "\n";
+ *theApp->getLog() << os.str().c_str();
+ }
+ }