r186: *** empty log message ***
[ctsim.git] / src / views.cpp
index edc35e6a00bdb417e313eed63798fd412bc2251c..3df51fa5e3c94227185b8acb602024602de88d15 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.17 2000/08/27 20:32:55 kevin Exp $
+**  $Id: views.cpp,v 1.18 2000/08/31 08:38:58 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
@@ -152,7 +152,7 @@ void
 ImageFileView::OnScaleAuto (wxCommandEvent& event)
 {
     const ImageFile& rIF = GetDocument()->getImageFile();
-    DialogAutoScaleParameters dialogAutoScale (m_frame, rIF);
+    DialogAutoScaleParameters dialogAutoScale (m_frame, rIF, m_dAutoScaleFactor);
     int iRetVal = dialogAutoScale.ShowModal();
     if (iRetVal == wxID_OK) {
       m_bMinSpecified = true;
@@ -161,6 +161,7 @@ ImageFileView::OnScaleAuto (wxCommandEvent& event)
       dialogAutoScale.getMinMax (&dMin, &dMax);
       m_dMinPixel = dMin;
       m_dMaxPixel = dMax;
+      m_dAutoScaleFactor = dialogAutoScale.getAutoScaleFactor();
       OnUpdate (this, NULL);
     }
 }
@@ -256,6 +257,7 @@ ImageFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
     
     m_bMinSpecified = false;
     m_bMaxSpecified = false;
+    m_dAutoScaleFactor = 1.;
 
     int width, height;
     m_frame->GetClientSize(&width, &height);
@@ -430,14 +432,21 @@ PhantomView::OnProjections (wxCommandEvent& event)
       if (iTrace > Trace::TRACE_CONSOLE) {
        ProjectionsDialog dialogProjections (theScanner, rProj, rPhantom, iTrace, dynamic_cast<wxWindow*>(m_frame));
        for (int iView = 0; iView < rProj.nView(); iView++) {
-         if (! dialogProjections.projectView (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);
+       theScanner.collectProjections (rProj, rPhantom, iTrace);
 
       pProjectionDoc->Modify(true);
       pProjectionDoc->UpdateAllViews(this);
@@ -447,6 +456,7 @@ PhantomView::OnProjections (wxCommandEvent& event)
        }
       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();
     }
   }
@@ -642,7 +652,7 @@ ProjectionFileView::OnProperties (wxCommandEvent& event)
 {
   const Projections& rProj = GetDocument()->getProjections();
   ostringstream os;
-  os << "ProjectionFile " << rProj.getFilename() << ":  Number of Detectors = " << rProj.nDet() << ", Number of Views = " << rProj.nView() << "\n";
+  rProj.printScanInfo(os);
   *theApp->getLog() << os.str().c_str();
 }