r631: no message
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 11 Mar 2001 15:27:30 +0000 (15:27 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 11 Mar 2001 15:27:30 +0000 (15:27 +0000)
16 files changed:
ChangeLog
include/backprojectors.h
include/reconstruct.h
include/sgp.h
libctgraphics/ezplot.cpp
libctgraphics/sgp.cpp
libctsim/backprojectors.cpp
libctsim/projections.cpp
libctsim/reconstruct.cpp
libctsim/scanner.cpp
msvc/ctsim/ctsim.plg
src/dialogs.cpp
src/dialogs.h
src/threadrecon.cpp
src/threadrecon.h
src/views.cpp

index 5d0a3918c73e03f282a961fc4bd87b29296d3b15..566e6a1917aaaff40de103dc98db2a7866726d0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,8 @@
 
        * ctsim: Added background and SMP processing for rasterization.
        
+       * ctsim: Added region of interest to reconstruction dialog.
+
        * ctsim: Added "Verbose Logging", "Startup Tips", and
        "Background processes" options  to Preferences dialog.
 
index 0a0cb1275dfdd8034db2b30df0d8c4a73d562c9c..d8f9bb56d5715b3d26054c03530e94af42638c8e 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backprojectors.h,v 1.24 2001/03/01 07:30:49 kevin Exp $
+**  $Id: backprojectors.h,v 1.25 2001/03/11 15:27:30 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
@@ -37,6 +37,7 @@
 class Backproject;
 class ImageFile;
 class Projections;
+struct ReconstructionROI;
 
 class Backprojector
 {
@@ -59,7 +60,8 @@ class Backprojector
   static const int INTERP_3BSPLINE;
 #endif
 
-  Backprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName, const int interpFactor);
+  Backprojector (const Projections& proj, ImageFile& im, const char* const backprojName, 
+    const char* const interpName, const int interpFactor, const ReconstructionROI* pROI);
 
   ~Backprojector ();
                 
@@ -101,14 +103,16 @@ class Backprojector
   static const char* const s_aszInterpTitle[];
   static const int s_iInterpCount;
 
-  bool initBackprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName, const int interpFactor);
+  bool initBackprojector (const Projections& proj, ImageFile& im, const char* const backprojName,
+    const char* const interpName, const int interpFactor, const ReconstructionROI* pROI);
 };
 
 
 class Backproject
 {
  public:
-    Backproject (const Projections& proj, ImageFile& im, int interpID, const int interpFactor);
+    Backproject (const Projections& proj, ImageFile& im, int interpID, const int interpFactor, 
+      const ReconstructionROI* pROI);
 
     virtual ~Backproject ();
 
@@ -145,8 +149,8 @@ class Backproject
 class BackprojectTrig : public Backproject
 {
  public:
-  BackprojectTrig (const Projections& proj, ImageFile& im, int interpID, const int interpFactor)
-      : Backproject (proj, im, interpID, interpFactor)
+  BackprojectTrig (const Projections& proj, ImageFile& im, int interpID, const int interpFactor, const ReconstructionROI* pROI)
+      : Backproject (proj, im, interpID, interpFactor, pROI)
       {}
 
   void BackprojectView (const double* const t, const double view_angle);
@@ -156,7 +160,7 @@ class BackprojectTrig : public Backproject
 class BackprojectTable : public Backproject
 {
  public:
-  BackprojectTable (const Projections& proj, ImageFile& im, int interpID, const int interpFactor);
+  BackprojectTable (const Projections& proj, ImageFile& im, int interpID, const int interpFactor, const ReconstructionROI* pROI);
   virtual ~BackprojectTable ();
 
   virtual void BackprojectView (const double* const t, const double view_angle);
@@ -173,7 +177,7 @@ class BackprojectTable : public Backproject
 class BackprojectDiff : public Backproject
 {
  public:
-  BackprojectDiff (const Projections& proj, ImageFile& im, int interpID, const int interpFactor);
+  BackprojectDiff (const Projections& proj, ImageFile& im, int interpID, const int interpFactor, const ReconstructionROI* pROI);
   ~BackprojectDiff ();
 
   virtual void BackprojectView (const double* const t, const double view_angle);
@@ -189,8 +193,8 @@ class BackprojectDiff : public Backproject
 class BackprojectIntDiff : public BackprojectDiff
 {
  public:
-  BackprojectIntDiff (const Projections& proj, ImageFile& im, int interpID, const int interpFactor)
-    :  BackprojectDiff (proj, im, interpID, interpFactor)
+  BackprojectIntDiff (const Projections& proj, ImageFile& im, int interpID, const int interpFactor, const ReconstructionROI* pROI)
+    :  BackprojectDiff (proj, im, interpID, interpFactor, pROI)
     {}
   
   void BackprojectView (const double* const t, const double view_angle);
@@ -199,8 +203,8 @@ class BackprojectIntDiff : public BackprojectDiff
 class BackprojectEquilinear : public BackprojectTable
 {
  public:
-  BackprojectEquilinear (const Projections& proj, ImageFile& im, int interpID, const int interpFactor)
-      : BackprojectTable (proj, im, interpID, interpFactor)
+  BackprojectEquilinear (const Projections& proj, ImageFile& im, int interpID, const int interpFactor,  const ReconstructionROI* pROI)
+      : BackprojectTable (proj, im, interpID, interpFactor, pROI)
       {}
 
   void BackprojectView (const double* const t, const double view_angle);
@@ -212,8 +216,8 @@ class BackprojectEquilinear : public BackprojectTable
 class BackprojectEquiangular : public BackprojectTable
 {
  public:
-  BackprojectEquiangular (const Projections& proj, ImageFile& im, int interpID, const int interpFactor)
-      : BackprojectTable (proj, im, interpID, interpFactor)
+  BackprojectEquiangular (const Projections& proj, ImageFile& im, int interpID, const int interpFactor,  const ReconstructionROI* pROI)
+      : BackprojectTable (proj, im, interpID, interpFactor, pROI)
       {}
 
   void BackprojectView (const double* const t, const double view_angle);
index 1e232e515ef52278cb3244823e6490e956b59f81..61df5257df5f38d542fb19b2b39f418cfacacdd5 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: reconstruct.h,v 1.7 2001/02/23 02:06:01 kevin Exp $
+**  $Id: reconstruct.h,v 1.8 2001/03/11 15:27:30 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
@@ -35,6 +35,13 @@ class ProcessSignal;
 
 #include <string>
 
+struct ReconstructionROI {
+  double m_dXMin;
+  double m_dYMin;
+  double m_dXMax;
+  double m_dYMax;
+};
+
 class Reconstructor 
 {
  private:
@@ -51,7 +58,10 @@ class Reconstructor
     double* m_adPlotXAxis;
 
  public:
-    Reconstructor (const Projections& rProj, ImageFile& rIF, const char* const filterName, double filt_param, const char* const filterMethodName, const int zeropad, const char* filterGenerationName, const char* const interpName, int interpFactor, const char* const backprojectName, const int trace, SGP* pSGP = NULL);
+    Reconstructor (const Projections& rProj, ImageFile& rIF, const char* const filterName, double filt_param, 
+      const char* const filterMethodName, const int zeropad, const char* filterGenerationName, 
+      const char* const interpName, int interpFactor, const char* const backprojectName, const int trace, 
+      ReconstructionROI* pROI = NULL, SGP* pSGP = NULL);
 
     ~Reconstructor ();
 
index 67f1b7c81ed9af6df9d3295ccb56c87fac85cc9b..9e4f8b9fa60eb80ac1620c39ea9a630ef46f5d4d 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: sgp.h,v 1.26 2001/01/28 19:10:18 kevin Exp $
+**  $Id: sgp.h,v 1.27 2001/03/11 15:27:30 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
@@ -129,6 +129,7 @@ private:
   bool m_bRecalcTransform;
   double m_dPointsPerPixel;  // points (72pt/in) per screen pixel;
   int m_iLinestyle;
+  int m_iMarker;
 
   // Master coordinates are coordinates before CTM transformation
   // World coordinates are coordinates defined by setWindow()
@@ -162,17 +163,17 @@ public:
   };
 
   enum {            // Codes for marker symbols
-      MARK_POINT = 0,  // small dot 
-      MARK_SQUARE = 1, // empty square 
-      MARK_FSQUARE = 2,        // filled square 
-      MARK_DIAMOND = 3,        // empty diamond 
-      MARK_FDIAMOND = 4,       // filled diamond 
-      MARK_CROSS =  5, // cross 
-      MARK_XCROSS = 6, // x 
-      MARK_CIRCLE = 7,    // open circle 
-      MARK_FCIRCLE = 8,        // filled circle 
-      MARK_BSQUARE = 9,        // big open square 
-      MARK_BDIAMOND = 10,      // big open diamond 
+      MARKER_POINT = 0,        // small dot 
+      MARKER_SQUARE = 1,       // empty square 
+      MARKER_FSQUARE = 2,      // filled square 
+      MARKER_DIAMOND = 3,      // empty diamond 
+      MARKER_FDIAMOND = 4,     // filled diamond 
+      MARKER_CROSS =  5,       // cross 
+      MARKER_XCROSS = 6,       // x 
+      MARKER_CIRCLE = 7,    // open circle 
+      MARKER_FCIRCLE = 8,      // filled circle 
+      MARKER_BSQUARE = 9,      // big open square 
+      MARKER_BDIAMOND = 10,    // big open diamond 
   };
   enum  { MARK_COUNT = 11, };
   static const unsigned char MARKER_BITMAP[MARK_COUNT][5];
@@ -208,7 +209,7 @@ public:
   void setTextAngle (double angle);
   void setTextColor (int iFGcolor, int iBGcolor);
   void setPenWidth (int width);
-  void setMarker (int idMarker, int color);
+  void setMarker (int idMarker);
   void setRasterOp (int ro);
 
   void getWindow (double& xmin, double& ymin, double& xmax, double& ymax);
index 79a4ebbb908c226babb1f72f2e54e03b16d0a328..cfab1d8ecc4ba6496554597b5de5fd814716fc1a 100644 (file)
@@ -6,7 +6,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: ezplot.cpp,v 1.32 2001/03/10 23:14:16 kevin Exp $
+**  $Id: ezplot.cpp,v 1.33 2001/03/11 15:27:30 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
@@ -868,7 +868,6 @@ EZPlot::plot (SGP* pSGP)
           if (y >= ygn_min && y <= ygn_max) {
             m_pSGP->moveAbs (x, y);
             symbol (iSym, symwidth, symheight);
-
           }
         }
     }
@@ -1102,11 +1101,12 @@ EZPlot::symbol (int sym, double symwidth, double symheight)
     return;
   
   if (sym == SB_CROSS) {
-    m_pSGP->moveRel (-0.5 * symwidth, -0.5 * symheight);
-    m_pSGP->lineRel (symwidth, symheight);
-    m_pSGP->moveRel (-symwidth, 0.0);
-    m_pSGP->lineRel (symwidth, -symheight);
-    m_pSGP->moveRel (-0.5 * symwidth, 0.5 * symheight);
+    m_pSGP->markerRel (0, 0);
+//    m_pSGP->moveRel (-0.5 * symwidth, -0.5 * symheight);
+//    m_pSGP->lineRel (symwidth, symheight);
+//    m_pSGP->moveRel (-symwidth, 0.0);
+//    m_pSGP->lineRel (symwidth, -symheight);
+//    m_pSGP->moveRel (-0.5 * symwidth, 0.5 * symheight);
   } else if (sym == SB_PLUS) {
     m_pSGP->moveRel (-0.5 * symwidth, 0.0);
     m_pSGP->lineRel (symwidth, 0.0);
index 57904a621f9a64120b4c210ef33db6fd84743438..ee325e1d0b314451a33491edcd963623d6c3cc6e 100644 (file)
@@ -7,7 +7,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: sgp.cpp,v 1.30 2001/03/10 23:14:16 kevin Exp $
+**  $Id: sgp.cpp,v 1.31 2001/03/11 15:27:30 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
@@ -104,6 +104,7 @@ SGP::SGP (const SGPDriver& driver)
   setTextPointSize (12);
   setColor (C_BLACK);
   setLineStyle (LS_SOLID);
+  setMarker (MARKER_POINT);
 }
 
 
@@ -170,6 +171,22 @@ SGP::stylusNDC (double x, double y, bool beam)
 void
 SGP::markerNDC (double x, double y)
 {
+  int xp = static_cast<int>(x * (m_iPhysicalXSize - 1) + 0.5);
+  int yp = static_cast<int>(y * (m_iPhysicalYSize - 1) + 0.5);
+  if (m_driver.isWX())
+    yp = m_iPhysicalYSize - yp;
+
+#if HAVE_WXWINDOWS
+  if (m_driver.isWX()) {
+      m_driver.idWX()->DrawPoint (xp, yp);
+      m_driver.idWX()->DrawPoint (xp-1, yp-1);
+      m_driver.idWX()->DrawPoint (xp+1, yp+1);
+      m_driver.idWX()->DrawPoint (xp+1, yp-1);
+      m_driver.idWX()->DrawPoint (xp-1, yp+1);
+  }
+#endif
+  m_iCurrentPhysicalX = xp;
+  m_iCurrentPhysicalY = yp;
 }
 
 void
@@ -406,8 +423,9 @@ SGP::setRasterOp (int ro)
 
 
 void
-SGP::setMarker (int idMarke, int iColor)
+SGP::setMarker (int idMarker)
 {
+  m_iMarker = idMarker;
 }
 
 //==============================================================
@@ -647,7 +665,6 @@ SGP::markerAbs (double x, double y)
   double yndc = y;
   mc_to_ndc.transformPoint (&xndc, &yndc);
   markerNDC (xndc, yndc); 
-  stylusNDC (xndc, yndc, false);            // move to location 
   m_dCurrentWorldX = x;
   m_dCurrentWorldY = y;
 }
index bfd594e8697ef0075b98ce6bce5b325261b4b082..06ad159b9d9577d73f099aee7a9586a3e19b6052 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backprojectors.cpp,v 1.30 2001/03/07 19:02:44 kevin Exp $
+**  $Id: backprojectors.cpp,v 1.31 2001/03/11 15:27:30 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
@@ -98,12 +98,13 @@ const int Backprojector::s_iInterpCount = sizeof(s_aszInterpName) / sizeof(const
 
 
 
-Backprojector::Backprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName, const int interpFactor)
+Backprojector::Backprojector (const Projections& proj, ImageFile& im, const char* const backprojName, 
+                              const char* const interpName, const int interpFactor, const ReconstructionROI* pROI)
 {
   m_fail = false;
   m_pBackprojectImplem = NULL;
   
-  initBackprojector (proj, im, backprojName, interpName, interpFactor);
+  initBackprojector (proj, im, backprojName, interpName, interpFactor, pROI);
 }
 
 void 
@@ -133,7 +134,8 @@ Backprojector::~Backprojector ()
 //     and initializes the backprojector
 
 bool
-Backprojector::initBackprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName, const int interpFactor)
+Backprojector::initBackprojector (const Projections& proj, ImageFile& im, const char* const backprojName, 
+                                  const char* const interpName, const int interpFactor, const ReconstructionROI* pROI)
 {
   m_nameBackproject = backprojName;
   m_nameInterpolation = interpName;
@@ -157,18 +159,18 @@ Backprojector::initBackprojector (const Projections& proj, ImageFile& im, const
   }
   
   if (proj.geometry() == Scanner::GEOMETRY_EQUILINEAR)
-    m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectEquilinear(proj, im, m_idInterpolation, interpFactor));
+    m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectEquilinear(proj, im, m_idInterpolation, interpFactor, pROI));
   else if (proj.geometry() == Scanner::GEOMETRY_EQUIANGULAR) 
-    m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectEquiangular(proj, im, m_idInterpolation, interpFactor));
+    m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectEquiangular(proj, im, m_idInterpolation, interpFactor, pROI));
   else if (proj.geometry() == Scanner::GEOMETRY_PARALLEL) {
     if (m_idBackproject == BPROJ_TRIG)
-      m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectTrig (proj, im, m_idInterpolation, interpFactor));
+      m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectTrig (proj, im, m_idInterpolation, interpFactor, pROI));
     else if (m_idBackproject == BPROJ_TABLE)
-      m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectTable (proj, im, m_idInterpolation, interpFactor));
+      m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectTable (proj, im, m_idInterpolation, interpFactor, pROI));
     else if (m_idBackproject == BPROJ_DIFF)
-      m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectDiff (proj, im, m_idInterpolation, interpFactor));
+      m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectDiff (proj, im, m_idInterpolation, interpFactor, pROI));
     else if (m_idBackproject == BPROJ_IDIFF)
-      m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectIntDiff (proj, im, m_idInterpolation, interpFactor));
+      m_pBackprojectImplem = static_cast<Backproject*>(new BackprojectIntDiff (proj, im, m_idInterpolation, interpFactor, pROI));
   } else {
     m_fail = true;
     m_failMessage = "Unable to select a backprojection method [Backprojector::initBackprojector]";
@@ -260,7 +262,8 @@ Backprojector::convertInterpIDToTitle (const int interpID)
 // PURPOSE
 //   Pure virtual base class for all backprojectors.
 
-Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType, const int interpFactor)
+Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType, const int interpFactor, 
+                          const ReconstructionROI* pROI)
 : proj(proj), im(im), interpType(interpType), m_interpFactor(interpFactor), m_bPostProcessingDone(false)
 {
   detInc = proj.detInc();
@@ -285,6 +288,28 @@ Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType
   yMin = -proj.phmLen() / 2;
   yMax = yMin + proj.phmLen();
   
+  if (pROI) {
+    if (pROI->m_dXMin > xMin)
+      xMin = pROI->m_dXMin;
+    if (pROI->m_dXMax < xMax)
+      xMax = pROI->m_dXMax;
+    if (pROI->m_dYMin > yMin)
+      yMin = pROI->m_dYMin;
+    if (pROI->m_dYMax < yMax)
+      yMax = pROI->m_dYMax;
+
+    if (xMin > xMax) {
+      double temp = xMin;
+      xMin = xMax;
+      xMax = temp;
+    }
+    if (yMin > yMax) {
+      double temp = yMin;
+      yMin = yMax;
+      yMax = temp;
+    }
+  }
+
   xInc = (xMax - xMin) / nx;   // size of cells
   yInc = (yMax - yMin) / ny;
   
@@ -384,8 +409,9 @@ BackprojectTrig::BackprojectView (const double* const filteredProj, const double
 // PURPOSE
 //   Precalculates trigometric function value for each point in image for backprojection.
 
-BackprojectTable::BackprojectTable (const Projections& proj, ImageFile& im, int interpType, const int interpFactor)
-: Backproject (proj, im, interpType, interpFactor)
+BackprojectTable::BackprojectTable (const Projections& proj, ImageFile& im, int interpType, 
+                                    const int interpFactor, const ReconstructionROI* pROI)
+: Backproject (proj, im, interpType, interpFactor, pROI)
 {
   arrayR.initSetSize (im.nx(), im.ny());
   arrayPhi.initSetSize (im.nx(), im.ny());
@@ -461,8 +487,9 @@ BackprojectTable::BackprojectView (const double* const filteredProj, const doubl
 //   Backprojects by precalculating the change in L position for each x & y step in the image.
 //   Iterates in x & y direction by adding difference in L position
 
-BackprojectDiff::BackprojectDiff (const Projections& proj, ImageFile& im, int interpType, const int interpFactor)
-:  Backproject (proj, im, interpType, interpFactor)
+BackprojectDiff::BackprojectDiff (const Projections& proj, ImageFile& im, int interpType, 
+                                  const int interpFactor, const ReconstructionROI* pROI)
+:  Backproject (proj, im, interpType, interpFactor, pROI)
 {
   // calculate center of first pixel v[0][0] 
   double x = xMin + xInc / 2;
index 85933de143d64d86e7f820d2415305bc9c7ee323..dc7248e62b9f3e42c86561612e99233c1bd6c245 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: projections.cpp,v 1.58 2001/03/11 12:37:34 kevin Exp $
+**  $Id: projections.cpp,v 1.59 2001/03/11 15:27:30 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
@@ -885,15 +885,14 @@ Projections::interpolatePolar (ImageFileArray& v, ImageFileArray& vImag,
   }
 }
 
-
 bool
 Projections::initFromSomatomAR_STAR (int iNViews, int iNDets, unsigned char* pData, unsigned long lDataLength)
 {
   init (iNViews, iNDets);
   m_geometry = Scanner::GEOMETRY_EQUIANGULAR;
   m_dFanBeamAngle = iNDets * convertDegreesToRadians (3.06976 / 60);
-  m_dFocalLength = 51;
-  m_dSourceDetectorLength = 89;
+  m_dFocalLength = 510;
+  m_dSourceDetectorLength = 890;
   m_detInc = convertDegreesToRadians (3.06976 / 60);
   m_detStart = -m_dFanBeamAngle / 2;
   m_rotInc = TWOPI / static_cast<double>(iNViews);
index 0c5cf0eb925c4e2a2a25028d637766856d422d2e..c3b6e8b65eb6777cace756dfe7c95544d52a9c70 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: reconstruct.cpp,v 1.15 2001/03/01 07:30:49 kevin Exp $
+**  $Id: reconstruct.cpp,v 1.16 2001/03/11 15:27:30 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
@@ -52,7 +52,8 @@
 Reconstructor::Reconstructor (const Projections& rProj, ImageFile& rIF, const char* const filterName, 
                               double filt_param, const char* const filterMethodName, const int zeropad, 
                               const char* filterGenerationName, const char* const interpName, 
-                              int interpFactor, const char* const backprojectName, const int iTrace, SGP* pSGP)
+                              int interpFactor, const char* const backprojectName, const int iTrace, 
+                              ReconstructionROI* pROI, SGP* pSGP)
   : m_rProj(rProj), m_rImagefile(rIF), m_pProcessSignal(0), m_pBackprojector(0), m_iTrace(iTrace), 
     m_bFail(false), m_adPlotXAxis(0)
 {
@@ -81,7 +82,7 @@ Reconstructor::Reconstructor (const Projections& rProj, ImageFile& rIF, const ch
     return;
   }
 
-  m_pBackprojector = new Backprojector (m_rProj, m_rImagefile, backprojectName, interpName, interpFactor);
+  m_pBackprojector = new Backprojector (m_rProj, m_rImagefile, backprojectName, interpName, interpFactor, pROI);
   if (m_pBackprojector->fail()) {
     m_bFail = true;
     m_strFailMessage = "Error creating backprojector: ";
index f28d9fa56030032499095b13596f433a466510f5..34899f5af643dbf94aff2a9795e1c5996349d412 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: scanner.cpp,v 1.35 2001/03/11 06:34:37 kevin Exp $
+**  $Id: scanner.cpp,v 1.36 2001/03/11 15:27:30 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
@@ -360,7 +360,7 @@ Scanner::collectProjections (Projections& proj, const Phantom& phm, const int iS
       traceShowParam ("Num Views:", "%d", PROJECTION_TRACE_ROW_NVIEW, C_BLUE, proj.nView());
       traceShowParam ("Samples / Ray:", "%d", PROJECTION_TRACE_ROW_SAMPLES, C_BLUE, m_nSample);
       
-      m_pSGP->setMarker (SGP::MARK_BDIAMOND, C_LTGREEN);
+      m_pSGP->setMarker (SGP::MARKER_BDIAMOND);
     }
 #endif
     
index cb2ca50c25f6a1a4f929fb7d46cbb653b62515ed..21230c3c30c2d6b139e8ce8feaa77435a6056b23 100644 (file)
@@ -6,13 +6,14 @@
 --------------------Configuration: libctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3D5.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP461.tmp" with contents
 [
 /nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "..\..\..\wx2.2.5\src\png" /I "..\..\..\wx2.2.5\src\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2.2.5\include" /I "\dicom\ctn\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "HAVE_CTN_DICOM" /D VERSION=\"3.1.0\" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
+"C:\ctsim\libctgraphics\ezplot.cpp"
 "C:\ctsim\libctsim\projections.cpp"
 ]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3D5.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3D6.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP461.tmp" 
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP462.tmp" with contents
 [
 /nologo /out:"Debug\libctsim.lib" 
 .\Debug\array2dfile.obj
@@ -48,16 +49,17 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3D6.tmp" with conten
 .\Debug\transformmatrix.obj
 .\Debug\xform.obj
 ]
-Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3D6.tmp"
+Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP462.tmp"
 <h3>Output Window</h3>
 Compiling...
+ezplot.cpp
 projections.cpp
 Creating library...
 <h3>
 --------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3D7.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP463.tmp" with contents
 [
 winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib ctn_lib.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib" /libpath:"\dicom\ctn\winctn\ctn_lib\Debug" 
 .\Debug\backgroundmgr.obj
@@ -84,7 +86,7 @@ winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..
 \wx2.2.5\lib\zlibd.lib
 \wx2.2.5\lib\tiffd.lib
 ]
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP3D7.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP463.tmp"
 <h3>Output Window</h3>
 Linking...
 
index 97c68adeda4a1ca407c0a17bec81a7872e8b7f04..b4811ed1faeb74aff28170b42c981a63f9df90e4 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: dialogs.cpp,v 1.49 2001/03/11 12:37:34 kevin Exp $
+**  $Id: dialogs.cpp,v 1.50 2001/03/11 15:27:30 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
@@ -648,13 +648,13 @@ DialogGetProjectionParameters::DialogGetProjectionParameters
   pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   pText2Sizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
 
-  std::ostringstream osCenterDetectorLength;
-  osCenterDetectorLength << dDefaultCenterDetectorLength;
-  m_pTextCtrlCenterDetectorLength = new wxTextCtrl (this, -1, osCenterDetectorLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
-  pText2Sizer->Add (new wxStaticText (this, -1, "Center-Detector Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
-  pText2Sizer->Add (m_pTextCtrlCenterDetectorLength, 0, wxALIGN_CENTER_VERTICAL);
-
   if (theApp->getAdvancedOptions()) {
+    std::ostringstream osCenterDetectorLength;
+    osCenterDetectorLength << dDefaultCenterDetectorLength;
+    m_pTextCtrlCenterDetectorLength = new wxTextCtrl (this, -1, osCenterDetectorLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+    pText2Sizer->Add (new wxStaticText (this, -1, "Center-Detector Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    pText2Sizer->Add (m_pTextCtrlCenterDetectorLength, 0, wxALIGN_CENTER_VERTICAL);
+
     std::ostringstream osRotAngle;
     osRotAngle << dDefaultRotAngle;
     m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
@@ -758,12 +758,15 @@ DialogGetProjectionParameters::getFocalLengthRatio ()
 double
 DialogGetProjectionParameters::getCenterDetectorLengthRatio ()
 {
-  wxString strCtrl = m_pTextCtrlCenterDetectorLength->GetValue();
-  double dValue;
-  if (strCtrl.ToDouble (&dValue))
-    return (dValue);
-  else
-    return (m_dDefaultCenterDetectorLength);
+  if (theApp->getAdvancedOptions()) {
+    wxString strCtrl = m_pTextCtrlCenterDetectorLength->GetValue();
+    double dValue;
+    if (strCtrl.ToDouble (&dValue))
+      return (dValue);
+    else
+      return (m_dDefaultCenterDetectorLength);
+  } else
+    return getFocalLengthRatio(); // default is to set equal to focal-length
 }
 
 double
@@ -812,11 +815,22 @@ DialogGetProjectionParameters::getTrace ()
 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize, 
                      int iDefaultYSize, int iDefaultFilterID, double dDefaultHammingParam,  
                      int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad, 
-                     int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
+                     int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace,
+                     ReconstructionROI* pDefaultROI)
 : wxDialog (pParent, -1, _T("Set Reconstruction Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
   
+  m_iDefaultXSize = iDefaultXSize;
+  m_iDefaultYSize = iDefaultYSize;
+  m_dDefaultFilterParam = dDefaultHammingParam;
+  m_iDefaultZeropad = iDefaultZeropad;
+  m_iDefaultInterpParam = iDefaultInterpParam;
+  m_dDefaultRoiXMin = pDefaultROI->m_dXMin;
+  m_dDefaultRoiXMax = pDefaultROI->m_dXMax;
+  m_dDefaultRoiYMin = pDefaultROI->m_dYMin;
+  m_dDefaultRoiYMax = pDefaultROI->m_dYMax;
+
   pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
   
@@ -909,7 +923,33 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow*
   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
 #endif  
-  
+
+  if (theApp->getAdvancedOptions()) {
+    wxFlexGridSizer* pROIGridSizer = new wxFlexGridSizer (2);
+    std::ostringstream osRoiXMin;
+    osRoiXMin << m_dDefaultRoiXMin;
+    m_pTextCtrlRoiXMin = new wxTextCtrl (this, -1, osRoiXMin.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+    pROIGridSizer->Add (new wxStaticText (this, -1, "ROI XMin"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    pROIGridSizer->Add (m_pTextCtrlRoiXMin, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+    std::ostringstream osRoiXMax;
+    osRoiXMax << m_dDefaultRoiXMax;
+    m_pTextCtrlRoiXMax = new wxTextCtrl (this, -1, osRoiXMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+    pROIGridSizer->Add (new wxStaticText (this, -1, "ROI XMax"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    pROIGridSizer->Add (m_pTextCtrlRoiXMax, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+    std::ostringstream osRoiYMin;
+    osRoiYMin << m_dDefaultRoiYMin;
+    m_pTextCtrlRoiYMin = new wxTextCtrl (this, -1, osRoiYMin.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+    pROIGridSizer->Add (new wxStaticText (this, -1, "ROI YMin"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    pROIGridSizer->Add (m_pTextCtrlRoiYMin, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+    std::ostringstream osRoiYMax;
+    osRoiYMax << m_dDefaultRoiYMax;
+    m_pTextCtrlRoiYMax = new wxTextCtrl (this, -1, osRoiYMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+    pROIGridSizer->Add (new wxStaticText (this, -1, "ROI YMax"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    pROIGridSizer->Add (m_pTextCtrlRoiYMax, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+
+    pGridSizer->Add (pROIGridSizer);
+  }
+
   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
   
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
@@ -1050,6 +1090,37 @@ DialogGetReconstructionParameters::getFilterGenerationName ()
   }
 }
 
+void
+DialogGetReconstructionParameters::getROI (ReconstructionROI* pROI)
+{
+  if (theApp->getAdvancedOptions()) {
+    double dValue;
+    if (m_pTextCtrlRoiXMin->GetValue().ToDouble (&dValue))
+      pROI->m_dXMin = dValue;
+    else
+      pROI->m_dXMin = m_dDefaultRoiXMin;
+
+    if (m_pTextCtrlRoiXMax->GetValue().ToDouble (&dValue))
+      pROI->m_dXMax = dValue;
+    else
+      pROI->m_dXMax = m_dDefaultRoiXMax;
+
+    if (m_pTextCtrlRoiYMin->GetValue().ToDouble (&dValue))
+      pROI->m_dYMin = dValue;
+    else
+      pROI->m_dYMin = m_dDefaultRoiYMin;
+
+    if (m_pTextCtrlRoiYMax->GetValue().ToDouble (&dValue))
+      pROI->m_dYMax = dValue;
+    else
+      pROI->m_dYMax = m_dDefaultRoiYMax;
+  } else {
+    pROI->m_dXMin = m_dDefaultRoiXMin;
+    pROI->m_dXMax = m_dDefaultRoiXMax;
+    pROI->m_dYMin = m_dDefaultRoiYMin;
+    pROI->m_dYMax = m_dDefaultRoiYMax;
+  }
+}
 
 /////////////////////////////////////////////////////////////////////
 // CLASS IDENTIFICATION
index 5f6fb0649794ea9622415d4cb7892614ab5a673e..ca82fc1d84b159503a46d123646514373015d69d 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: dialogs.h,v 1.33 2001/03/01 20:02:18 kevin Exp $
+**  $Id: dialogs.h,v 1.34 2001/03/11 15:27:30 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
@@ -231,7 +231,7 @@ class DialogGetReconstructionParameters : public wxDialog
       int iDefaultFilterGeneration = ProcessSignal::FILTER_GENERATION_DIRECT, 
       int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR, 
       int iDefaultInterpParam = 1, int iDefaultBackprojectID = Backprojector::BPROJ_IDIFF, 
-      int iDefaultTrace = Trace::TRACE_NONE);
+      int iDefaultTrace = Trace::TRACE_NONE, ReconstructionROI* pROI = NULL);
     virtual ~DialogGetReconstructionParameters ();
 
     unsigned int getXSize();
@@ -244,6 +244,7 @@ class DialogGetReconstructionParameters : public wxDialog
     const char* getInterpName();
     unsigned int getInterpParam();
     const char* getBackprojectName();
+    void getROI (ReconstructionROI* pROI);
     int getTrace ();
 
  private:
@@ -252,7 +253,10 @@ class DialogGetReconstructionParameters : public wxDialog
     wxTextCtrl* m_pTextCtrlZeropad;
     wxTextCtrl* m_pTextCtrlFilterParam;
     wxTextCtrl* m_pTextCtrlInterpParam;
-
+    wxTextCtrl* m_pTextCtrlRoiXMin;
+    wxTextCtrl* m_pTextCtrlRoiXMax;
+    wxTextCtrl* m_pTextCtrlRoiYMin;
+    wxTextCtrl* m_pTextCtrlRoiYMax;
     StringValueAndTitleRadioBox* m_pRadioBoxFilter;
     StringValueAndTitleRadioBox* m_pRadioBoxFilterMethod;
     StringValueAndTitleRadioBox* m_pRadioBoxFilterGeneration;
@@ -265,7 +269,10 @@ class DialogGetReconstructionParameters : public wxDialog
     double m_dDefaultFilterParam;
     int m_iDefaultZeropad;
     int m_iDefaultInterpParam;
-    int m_iDefaultTrace;
+    double m_dDefaultRoiXMin;
+    double m_dDefaultRoiXMax;
+    double m_dDefaultRoiYMin;
+    double m_dDefaultRoiYMax;
 };
 
 
index e4bf3c5e558c249e7594113d027a6290a82f753d..e8deca41e6809f065135d49d6eaa946d88d7e144 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadrecon.cpp,v 1.23 2001/03/09 03:54:25 kevin Exp $
+**  $Id: threadrecon.cpp,v 1.24 2001/03/11 15:27:30 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
 ReconstructorSupervisorThread::ReconstructorSupervisorThread (ProjectionFileView* pProjView, int iNX, int iNY, 
    const char* pszFilterName, double dFilterParam, const char* pszFilterMethod, int iZeropad, 
    const char* pszFilterGenerationName, const char* pszInterpName, int iInterpParam, 
-   const char* pszBackprojectName, const char* const pszLabel)
+   const char* pszBackprojectName, const char* const pszLabel, ReconstructionROI* pROI)
 :   SupervisorThread(), m_pProjView(pProjView), m_iNX(iNX), m_iNY(iNY), m_strFilterName(pszFilterName), m_dFilterParam(dFilterParam), 
   m_strFilterMethod(pszFilterMethod), m_iZeropad(iZeropad), m_strFilterGenerationName(pszFilterGenerationName), 
-  m_strInterpName(pszInterpName), m_iInterpParam(iInterpParam), m_strBackprojectName(pszBackprojectName), m_strLabel(pszLabel)
+  m_strInterpName(pszInterpName), m_iInterpParam(iInterpParam), m_strBackprojectName(pszBackprojectName), 
+  m_strLabel(pszLabel), m_reconROI(*pROI)
 {
 }
 
@@ -66,7 +67,7 @@ ReconstructorSupervisorThread::Entry()
 {
   ReconstructorSupervisor reconSupervisor (this, m_pProjView, m_iNX, m_iNY, 
    m_strFilterName.c_str(), m_dFilterParam, m_strFilterMethod.c_str(), m_iZeropad, m_strFilterGenerationName.c_str(), 
-   m_strInterpName.c_str(), m_iInterpParam, m_strBackprojectName.c_str(), m_strLabel.c_str());
+   m_strInterpName.c_str(), m_iInterpParam, m_strBackprojectName.c_str(), m_strLabel.c_str(), &m_reconROI);
 
   reconSupervisor.start();
   while (! reconSupervisor.workersDone() && ! reconSupervisor.fail() && ! reconSupervisor.cancelled()) {
@@ -103,13 +104,14 @@ ReconstructorSupervisorThread::OnExit()
 ReconstructorSupervisor::ReconstructorSupervisor (SupervisorThread* pThread, ProjectionFileView* pProjView, 
   int iImageNX, int iImageNY, const char* pszFilterName, double dFilterParam, const char* pszFilterMethod, 
   int iZeropad, const char* pszFilterGenerationName, const char* pszInterpName, int iInterpParam,
-  const char* pszBackprojectName, const char* const pszLabel)
+  const char* pszBackprojectName, const char* const pszLabel, ReconstructionROI* pROI)
     : BackgroundSupervisor (pThread, pProjView->GetFrame(), pProjView->GetDocument(), "Reconstructing", pProjView->GetDocument()->getProjections().nView()),
       m_pProjView(pProjView), m_pProjDoc(pProjView->GetDocument()), 
       m_iImageNX(iImageNX), m_iImageNY(iImageNY), 
       m_pszFilterName(pszFilterName), m_dFilterParam(dFilterParam), m_pszFilterMethod(pszFilterMethod),
       m_iZeropad(iZeropad), m_pszFilterGenerationName(pszFilterGenerationName), m_pszInterpName(pszInterpName),
-      m_iInterpParam(iInterpParam), m_pszBackprojectName(pszBackprojectName), m_pszLabel(pszLabel) 
+      m_iInterpParam(iInterpParam), m_pszBackprojectName(pszBackprojectName), m_pszLabel(pszLabel),
+      m_pReconROI(pROI)
 {
   m_vecpChildImageFile.reserve (getNumWorkers());
   for (int iThread = 0; iThread < getNumWorkers(); iThread++) {
@@ -132,7 +134,7 @@ ReconstructorSupervisor::createWorker (int iThread, int iStartUnit, int iNumUnit
    ReconstructorWorker* pThread = new ReconstructorWorker (this, iThread, iStartUnit, iNumUnits);
    pThread->SetParameters (m_pProjView, m_vecpChildImageFile[iThread], m_pszFilterName, m_dFilterParam, 
      m_pszFilterMethod, m_iZeropad, m_pszFilterGenerationName, m_pszInterpName,
-     m_iInterpParam, m_pszBackprojectName);
+     m_iInterpParam, m_pszBackprojectName, m_pReconROI);
 
    return pThread;
 }
@@ -190,7 +192,7 @@ void
 ReconstructorWorker::SetParameters (ProjectionFileView* pProjView, ImageFile* pImageFile, 
  const char* pszFilterName, double dFilterParam, const char* pszFilterMethod, int iZeropad,
  const char* pszFilterGenerationName, const char* pszInterpName, int iInterpParam, 
- const char* pszBackprojectName)
+ const char* pszBackprojectName, ReconstructionROI* pROI)
 {
    m_pProjView = pProjView;
    m_pImageFile = pImageFile;
@@ -202,6 +204,7 @@ ReconstructorWorker::SetParameters (ProjectionFileView* pProjView, ImageFile* pI
    m_pszInterpName = pszInterpName;
    m_iInterpParam = iInterpParam;
    m_pszBackprojectName = pszBackprojectName;
+   m_pReconROI = pROI;
 }
 
 wxThread::ExitCode
@@ -209,7 +212,8 @@ ReconstructorWorker::Entry ()
 {
   Reconstructor* pReconstructor = new Reconstructor (m_pProjView->GetDocument()->getProjections(), 
     *m_pImageFile, m_pszFilterName, m_dFilterParam, m_pszFilterMethod, m_iZeropad, 
-    m_pszFilterGenerationName, m_pszInterpName, m_iInterpParam, m_pszBackprojectName, Trace::TRACE_NONE);
+    m_pszFilterGenerationName, m_pszInterpName, m_iInterpParam, m_pszBackprojectName, Trace::TRACE_NONE,
+    m_pReconROI);
 
   bool bFail = pReconstructor->fail();
   std::string failMsg;
index 89c58fe61ff27e3788b9a78a2453ec793627cac0..0b56a8c69cf33649fa29a4d7fd72ff767468c3e9 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadrecon.h,v 1.12 2001/03/05 19:14:40 kevin Exp $
+**  $Id: threadrecon.h,v 1.13 2001/03/11 15:27:30 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
@@ -43,6 +43,7 @@ class ImageFile;
 class ProjectionFileDocument;
 class ReconstructorWorker;
 class ProjectionFileView;
+struct ReconstructionROI;
 
 class ReconstructorSupervisorThread : public SupervisorThread {
 private:
@@ -59,11 +60,13 @@ private:
   const int m_iInterpParam;
   const std::string m_strBackprojectName;
   const std::string m_strLabel;
+  ReconstructionROI m_reconROI;
 
 public:
   ReconstructorSupervisorThread(ProjectionFileView* pProjView, int iNX, int iNY, const char* pszFilterName, 
    double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName, 
-   const char* pszInterpName, int iInterpParam, const char* pszBackprojectName, const char* const pszLabel);
+   const char* pszInterpName, int iInterpParam, const char* pszBackprojectName, const char* const pszLabel,
+   ReconstructionROI* pROI);
 
   virtual wxThread::ExitCode Entry();
 
@@ -91,11 +94,13 @@ private:
   const int m_iInterpParam;
   const char* const m_pszBackprojectName;
   const char* const m_pszLabel;
+  ReconstructionROI* m_pReconROI;
 
 public:
    ReconstructorSupervisor (SupervisorThread* pMyThread, ProjectionFileView* pProjView, int iNX, int iNY, const char* pszFilterName, 
    double dFilterParam, const char* pszFilterMethod, int iZeropad, const char* pszFilterGenerationName, 
-   const char* pszInterpName, int iInterpParam, const char* pszBackprojectName, const char* const pszLabel);
+   const char* pszInterpName, int iInterpParam, const char* pszBackprojectName, const char* const pszLabel,
+   ReconstructionROI* pReconROI);
 
    virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
 
@@ -122,6 +127,7 @@ private:
   const char* m_pszInterpName;
   int m_iInterpParam;
   const char* m_pszBackprojectName;
+  ReconstructionROI* m_pReconROI;
 
 public:
   ReconstructorWorker (ReconstructorSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews) 
@@ -131,7 +137,7 @@ public:
   void SetParameters (ProjectionFileView* pProjFile, ImageFile* pImageFile, 
    const char* const pszFilterName, double dFilterParam, const char* const pszFilterMethod, 
    int iZeropad, const char* const pszFilterGenerationName, const char* const pszInterpName, int iInterpParam,
-   const char* pszBackprojectName);
+   const char* pszBackprojectName, ReconstructionROI* pROI);
 
   virtual wxThread::ExitCode Entry();      // thread execution starts here
 
index 9a2eb3113b23ed9f9f3f6796c9e974a570a7e30c..c9689bfab866a05e6b81b901f2d697b0198d2a07 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.132 2001/03/11 06:34:37 kevin Exp $
+**  $Id: views.cpp,v 1.133 2001/03/11 15:27:30 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
@@ -2459,6 +2459,7 @@ ProjectionFileView::OnConvertParallel (wxCommandEvent& event)
     wxMessageBox ("Projections are already parallel", "Error");
     return;
   }
+  wxProgressDialog dlgProgress (wxString("Convert to Parallel"), wxString("Conversion Progress"), 1, getFrameForChild(), wxPD_APP_MODAL);
   Projections* pProjNew = rProj.interpolateToParallel();
   ProjectionFileDocument* pProjDocNew = theApp->newProjectionDoc();
   pProjDocNew->setProjections (pProjNew);  
@@ -2488,10 +2489,17 @@ ProjectionFileView::OnReconstructFourier (wxCommandEvent& event)
 void
 ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
 {
+  const Projections& rProj = GetDocument()->getProjections();
+  ReconstructionROI defaultROI;
+  defaultROI.m_dXMin = -rProj.phmLen() / 2;
+  defaultROI.m_dXMax = defaultROI.m_dXMin + rProj.phmLen();
+  defaultROI.m_dYMin = -rProj.phmLen() / 2;
+  defaultROI.m_dYMax = defaultROI.m_dYMin + rProj.phmLen();
+
   DialogGetReconstructionParameters dialogReconstruction (getFrameForChild(), m_iDefaultNX, m_iDefaultNY, 
     m_iDefaultFilter, m_dDefaultFilterParam, m_iDefaultFilterMethod, m_iDefaultFilterGeneration, 
     m_iDefaultZeropad, m_iDefaultInterpolation, m_iDefaultInterpParam, m_iDefaultBackprojector, 
-    m_iDefaultTrace);
+    m_iDefaultTrace,  &defaultROI);
   
   int retVal = dialogReconstruction.ShowModal();
   if (retVal != wxID_OK)
@@ -2513,11 +2521,11 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
   wxString optBackprojectName = dialogReconstruction.getBackprojectName();
   m_iDefaultBackprojector = Backprojector::convertBackprojectNameToID (optBackprojectName.c_str());
   m_iDefaultTrace = dialogReconstruction.getTrace();
-  
+  dialogReconstruction.getROI (&defaultROI);
+
   if (m_iDefaultNX <= 0 && m_iDefaultNY <= 0) 
     return;
   
-  const Projections& rProj = GetDocument()->getProjections();
   std::ostringstream os;
   os << "Reconstruct " << rProj.getFilename() << ": xSize=" << m_iDefaultNX << ", ySize=" << m_iDefaultNY << ", Filter=" << optFilterName.c_str() << ", FilterParam=" << m_dDefaultFilterParam << ", FilterMethod=" << optFilterMethodName.c_str() << ", FilterGeneration=" << optFilterGenerationName.c_str() << ", Zeropad=" << m_iDefaultZeropad << ", Interpolation=" << optInterpName.c_str() << ", InterpolationParam=" << m_iDefaultInterpParam << ", Backprojection=" << optBackprojectName.c_str();
   
@@ -2527,7 +2535,7 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
     pImageFile = new ImageFile (m_iDefaultNX, m_iDefaultNY);
     Reconstructor* pReconstructor = new Reconstructor (rProj, *pImageFile, optFilterName.c_str(), 
       m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(), 
-      optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace);
+      optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace, &defaultROI);
     
     ReconstructDialog* pDlgReconstruct = new ReconstructDialog (*pReconstructor, rProj, *pImageFile, m_iDefaultTrace, getFrameForChild());
     for (int iView = 0; iView < rProj.nView(); iView++) {
@@ -2553,7 +2561,7 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
       ReconstructorSupervisorThread* pReconstructor = new ReconstructorSupervisorThread (this, 
         m_iDefaultNX, m_iDefaultNY, optFilterName.c_str(), 
         m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(), 
-        optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), os.str().c_str());
+        optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), os.str().c_str(), &defaultROI);
       if (pReconstructor->Create() != wxTHREAD_NO_ERROR) {
         sys_error (ERR_SEVERE, "Error creating reconstructor thread");
         delete pReconstructor;
@@ -2568,7 +2576,7 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
       pImageFile = new ImageFile (m_iDefaultNX, m_iDefaultNY);
       Reconstructor* pReconstructor = new Reconstructor (rProj, *pImageFile, optFilterName.c_str(), 
         m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(), 
-        optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace);
+        optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace, &defaultROI);
       
       wxProgressDialog dlgProgress (wxString("Reconstruction"), wxString("Reconstruction Progress"), rProj.nView() + 1, getFrameForChild(), wxPD_CAN_ABORT );
       for (int iView = 0; iView < rProj.nView(); iView++) {