r1018: *** empty log message ***
[ctsim.git] / src / views.cpp
index afceae446d164897f38e555558737d282ea2716f..f78f9e3470dd319b5086ea5e819d2fa43c6d0147 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.145 2001/03/30 21:01:15 kevin Exp $
+**  $Id: views.cpp,v 1.146 2001/09/24 09:40:42 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
@@ -2003,6 +2003,7 @@ PhantomFileView::PhantomFileView()
   m_iDefaultNView = 320;
   m_iDefaultNSample = 2;
 #endif
+  m_iDefaultOffsetView = 0;
   m_dDefaultRotation = 1;
   m_dDefaultFocalLength = 2;
   m_dDefaultCenterDetectorLength = 2;
@@ -2051,7 +2052,7 @@ void
 PhantomFileView::OnProjections (wxCommandEvent& event)
 {
   DialogGetProjectionParameters dialogProjection (getFrameForChild(), 
-    m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation, 
+    m_iDefaultNDet, m_iDefaultNView, m_iDefaultOffsetView, m_iDefaultNSample, m_dDefaultRotation, 
     m_dDefaultFocalLength, m_dDefaultCenterDetectorLength, m_dDefaultViewRatio, m_dDefaultScanRatio, 
     m_iDefaultGeometry, m_iDefaultTrace);
   int retVal = dialogProjection.ShowModal();
@@ -2060,6 +2061,7 @@ PhantomFileView::OnProjections (wxCommandEvent& event)
   
   m_iDefaultNDet = dialogProjection.getNDet();
   m_iDefaultNView = dialogProjection.getNView();
+  m_iDefaultOffsetView = dialogProjection.getOffsetView();
   m_iDefaultNSample = dialogProjection.getNSamples();
   m_iDefaultTrace = dialogProjection.getTrace();
   m_dDefaultRotation = dialogProjection.getRotAngle();
@@ -2076,7 +2078,7 @@ PhantomFileView::OnProjections (wxCommandEvent& event)
     return;
   
   const Phantom& rPhantom = GetDocument()->getPhantom();
-  Scanner theScanner (rPhantom, sGeometry.c_str(), m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, 
+  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";
@@ -2087,13 +2089,18 @@ PhantomFileView::OnProjections (wxCommandEvent& event)
   }
   
   std::ostringstream os;
-  os << "Projections for " << rPhantom.name() << ": nDet=" << m_iDefaultNDet 
-    << ", nView=" << m_iDefaultNView << ", nSamples=" << m_iDefaultNSample 
-    << ", RotAngle=" << m_dDefaultRotation << ", FocalLengthRatio=" << m_dDefaultFocalLength 
+  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());
+    << ", ViewRatio=" << m_dDefaultViewRatio 
+       << ", ScanRatio=" << m_dDefaultScanRatio 
+    << ", Geometry=" << sGeometry.c_str() 
+       << ", FanBeamAngle=" << convertRadiansToDegrees (theScanner.fanBeamAngle());
   
   Timer timer;
   Projections* pProj = NULL;
@@ -2118,7 +2125,7 @@ PhantomFileView::OnProjections (wxCommandEvent& event)
 #if HAVE_WXTHREADS
     if (theApp->getUseBackgroundTasks()) {
       ProjectorSupervisorThread* pProjector = new ProjectorSupervisorThread (this, m_iDefaultNDet,
-        m_iDefaultNView, sGeometry.c_str(), m_iDefaultNSample, dRotationRadians,
+        m_iDefaultNView, m_iDefaultOffsetView, sGeometry.c_str(), m_iDefaultNSample, dRotationRadians,
         m_dDefaultFocalLength, m_dDefaultCenterDetectorLength, m_dDefaultViewRatio, m_dDefaultScanRatio, os.str().c_str());
       if (pProjector->Create() != wxTHREAD_NO_ERROR) {
         sys_error (ERR_SEVERE, "Error creating projector thread");
@@ -2135,7 +2142,8 @@ PhantomFileView::OnProjections (wxCommandEvent& event)
       pProj->initFromScanner (theScanner);
       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);
+        //theScanner.collectProjections (*pProj, rPhantom, i, 1, true, m_iDefaultTrace);
+        theScanner.collectProjections (*pProj, rPhantom, i, 1, theScanner.offsetView(), true, m_iDefaultTrace);
         if (! dlgProgress.Update (i+1)) {
           delete pProj;
           return;