r574: no message
authorKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 23 Feb 2001 02:06:02 +0000 (02:06 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 23 Feb 2001 02:06:02 +0000 (02:06 +0000)
14 files changed:
doc/ctsim-concepts.tex
doc/ctsim-gui.tex
doc/ctsim-textui.tex
include/backprojectors.h
include/reconstruct.h
libctsim/backprojectors.cpp
libctsim/reconstruct.cpp
msvc/ctsim/ctsim.plg
src/backgroundmgr.cpp
src/backgroundmgr.h
src/threadrecon.cpp
src/threadrecon.h
src/views.cpp
tools/pjrec.cpp

index 1b53d60671da122a033dee3f618b4582452542c2..bacfd4b4807969b66469c0833c9c682d08ee9c02 100644 (file)
@@ -316,7 +316,7 @@ accurate as filtered backprojection. This is due primarily
 to interpolation occurring in the frequency domain rather than the
 spatial domain.
 
 to interpolation occurring in the frequency domain rather than the
 spatial domain.
 
-\subsection{Filtered Backprojection}\index{Filtered backprojection}
+\subsection{Filtered Backprojection}\index{Filtered backprojection}\index{Symmetric multiprocessing}\index{SMP}
 The technique is comprised of two sequential steps:
 filtering projections followed by backprojecting the filtered projections. Though
 these two steps are sequential, each view position can be processed independently.
 The technique is comprised of two sequential steps:
 filtering projections followed by backprojecting the filtered projections. Though
 these two steps are sequential, each view position can be processed independently.
@@ -324,9 +324,18 @@ these two steps are sequential, each view position can be processed independentl
 \subsubsection{Parallel Computer Processing}\index{Parallel processing}
 Since each view can be processed independently, filtered backprojection is amendable to
 parallel processing. Indeed, this has been used in commercial scanners to speed reconstruction.
 \subsubsection{Parallel Computer Processing}\index{Parallel processing}
 Since each view can be processed independently, filtered backprojection is amendable to
 parallel processing. Indeed, this has been used in commercial scanners to speed reconstruction.
-This parallelism is exploited in the MPI versions of \ctsim\ where the
-data from all the views are spread about amongst all of the
-processors. This has been testing in a cluster of 16 computers with excellent
+This parallelism is exploited both in the \ctsim\ graphical shell and
+in the \helpref{LAM}{ctsimtextlam} version of \ctsimtext. \ctsim\ can distribute it's workload
+amongst multiple processors working in parallel.
+
+The graphical shell will automatically take advantage of multiple CPU's when
+running on a \emph{Symmetric Multiprocessing}
+computer. Dual-CPU computers are commonly available which provide a near doubling
+in reconstruction speeds. \ctsim, though, has no limits on the number of CPU's
+that can be used in parallel. The \emph{LAM} version
+of \ctsimtext\ is designed to work in a cluster of computers.
+This has been testing with a cluster of 16 computers in a
+\urlref{Beowulf-class}{http://www.beowulf.org} cluster with excellent
 results.
 
 \subsubsection{Filter projections}
 results.
 
 \subsubsection{Filter projections}
index 21687029c6930745d3112823540b09e83e570ea0..923554a0bbd9c9651e3496682848569f988f12bf 100644 (file)
@@ -180,6 +180,12 @@ usual. There extra events are not important for viewing with typical operation o
 new installations. With this option set, \ctsim\ will display
 helpful tips when \ctsim\ is started.}
 
 new installations. With this option set, \ctsim\ will display
 helpful tips when \ctsim\ is started.}
 
+\twocolitem{\textbf{Run background tasks}}{This option is initially turned off in
+new installations. With this option set, \ctsim\ execute lengthy calculations in the
+background. A background window will appear when processes are running in the background
+and will disappear when no background processes are executing. This background window shows
+the status and progress of all background processes.}
+
 \end{twocollist}
 
 \subsection{File - Open}
 \end{twocollist}
 
 \subsection{File - Open}
index 07e73c394ad31e8b9edfd439de9e16d9530011fb..f926e0211976d02959dbb055512230b8cb85861d 100644 (file)
@@ -36,7 +36,7 @@ as a shortcut to the equivalent command \\
 
 \end{enumerate}
 
 
 \end{enumerate}
 
-\section{Parallel Processing}\index{Parallel processing}
+\section{Parallel Processing}\label{ctsimtextlam}\index{Parallel processing}\index{MPI}\index{LAM}
 \ctsimtext\ can distribute it's processing over a cluster. Specifically,
 \ctsimtext\ supports the \urlref{LAM}{http://www.mpi.nd.edu/lam} version of
 the MPI environment. On platforms with LAM installed, a parallel version of
 \ctsimtext\ can distribute it's processing over a cluster. Specifically,
 \ctsimtext\ supports the \urlref{LAM}{http://www.mpi.nd.edu/lam} version of
 the MPI environment. On platforms with LAM installed, a parallel version of
index bd30b9cf47c0a4739da2f301e023505506d0f26f..ce5b108da83e4925ae7c1aae422f7cfa8d236f18 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backprojectors.h,v 1.22 2001/02/22 18:22:40 kevin Exp $
+**  $Id: backprojectors.h,v 1.23 2001/02/23 02:06:01 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
 **
 **  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
@@ -64,6 +64,7 @@ class Backprojector
   ~Backprojector ();
                 
   void BackprojectView (const double* const viewData, const double viewAngle);
   ~Backprojector ();
                 
   void BackprojectView (const double* const viewData, const double viewAngle);
+  void PostProcessing();
 
   bool fail() const {return m_fail;}
   const std::string& failMessage() const {return m_failMessage;}
 
   bool fail() const {return m_fail;}
   const std::string& failMessage() const {return m_failMessage;}
@@ -111,13 +112,13 @@ class Backproject
 
     virtual ~Backproject ();
 
 
     virtual ~Backproject ();
 
-    virtual void BackprojectView (const double* const viewData, const double viewAngle) {};
+    virtual void BackprojectView (const double* const viewData, const double viewAngle) = 0;
+    virtual void PostProcessing (); // call after backprojecting all views
 
  protected:
     void ScaleImageByRotIncrement ();
     void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double r, double phi, double L, int ni);
     void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double L, int ni);
 
  protected:
     void ScaleImageByRotIncrement ();
     void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double r, double phi, double L, int ni);
     void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double L, int ni);
-
     const Projections& proj;
     ImageFile& im;
     int interpType;
     const Projections& proj;
     ImageFile& im;
     int interpType;
@@ -132,6 +133,7 @@ class Backproject
     double xInc, yInc; // size of cells
     int m_interpFactor;
     double m_dFocalLength;
     double xInc, yInc; // size of cells
     int m_interpFactor;
     double m_dFocalLength;
+    bool m_bPostProcessingDone;
 
  private:
     Backproject (const Backproject& rhs);
 
  private:
     Backproject (const Backproject& rhs);
@@ -156,7 +158,8 @@ class BackprojectTable : public Backproject
   BackprojectTable (const Projections& proj, ImageFile& im, int interpID, const int interpFactor);
   virtual ~BackprojectTable ();
 
   BackprojectTable (const Projections& proj, ImageFile& im, int interpID, const int interpFactor);
   virtual ~BackprojectTable ();
 
-  void BackprojectView (const double* const t, const double view_angle);
+  virtual void BackprojectView (const double* const t, const double view_angle);
+  virtual void PostProcessing (); // call after backprojecting all views
 
  protected:
   Array2d<kfloat64> arrayR;
 
  protected:
   Array2d<kfloat64> arrayR;
@@ -172,7 +175,8 @@ class BackprojectDiff : public Backproject
   BackprojectDiff (const Projections& proj, ImageFile& im, int interpID, const int interpFactor);
   ~BackprojectDiff ();
 
   BackprojectDiff (const Projections& proj, ImageFile& im, int interpID, const int interpFactor);
   ~BackprojectDiff ();
 
-  void BackprojectView (const double* const t, const double view_angle);
+  virtual void BackprojectView (const double* const t, const double view_angle);
+  virtual void PostProcessing (); // call after backprojecting all views
 
  protected:
   double start_r;
 
  protected:
   double start_r;
index 54f19f0194a984fdb3e54b961a1d06ec987e5f80..1e232e515ef52278cb3244823e6490e956b59f81 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: reconstruct.h,v 1.6 2001/02/20 04:48:45 kevin Exp $
+**  $Id: reconstruct.h,v 1.7 2001/02/23 02:06:01 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
 **
 **  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
@@ -63,6 +63,7 @@ class Reconstructor
     void reconstructAllViews ();
 
     void reconstructView (int iStartView = 0, int iViewCount = -1, SGP* pSGP = NULL, bool bBackprojectView = true, double dGraphWidth = 1.);
     void reconstructAllViews ();
 
     void reconstructView (int iStartView = 0, int iViewCount = -1, SGP* pSGP = NULL, bool bBackprojectView = true, double dGraphWidth = 1.);
+    void postProcessing ();
 };
 
 #endif
 };
 
 #endif
index ebfe2a4358326b16aafafb2b30ef8fe84b3240f9..fc3c95882dd768458613be752749c10e759978a9 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backprojectors.cpp,v 1.27 2001/02/22 18:22:40 kevin Exp $
+**  $Id: backprojectors.cpp,v 1.28 2001/02/23 02:06:01 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
 **
 **  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
@@ -113,6 +113,13 @@ Backprojector::BackprojectView (const double* const viewData, const double viewA
     m_pBackprojectImplem->BackprojectView (viewData, viewAngle);
 }
 
     m_pBackprojectImplem->BackprojectView (viewData, viewAngle);
 }
 
+void 
+Backprojector::PostProcessing()
+{
+  if (m_pBackprojectImplem != NULL)
+    m_pBackprojectImplem->PostProcessing();
+}
+
 Backprojector::~Backprojector ()
 {
   delete m_pBackprojectImplem;
 Backprojector::~Backprojector ()
 {
   delete m_pBackprojectImplem;
@@ -254,7 +261,7 @@ Backprojector::convertInterpIDToTitle (const int interpID)
 //   Pure virtual base class for all backprojectors.
 
 Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType, const int interpFactor)
 //   Pure virtual base class for all backprojectors.
 
 Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType, const int interpFactor)
-: proj(proj), im(im), interpType(interpType), m_interpFactor(interpFactor)
+: proj(proj), im(im), interpType(interpType), m_interpFactor(interpFactor), m_bPostProcessingDone(false)
 {
   detInc = proj.detInc();
   nDet = proj.nDet();
 {
   detInc = proj.detInc();
   nDet = proj.nDet();
@@ -287,6 +294,12 @@ Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType
 Backproject::~Backproject ()
 {}
 
 Backproject::~Backproject ()
 {}
 
+void
+Backproject::PostProcessing()
+{
+  m_bPostProcessingDone = true;
+}
+
 void
 Backproject::ScaleImageByRotIncrement ()
 {
 void
 Backproject::ScaleImageByRotIncrement ()
 {
@@ -389,7 +402,15 @@ BackprojectTable::BackprojectTable (const Projections& proj, ImageFile& im, int
 
 BackprojectTable::~BackprojectTable ()
 {
 
 BackprojectTable::~BackprojectTable ()
 {
-  ScaleImageByRotIncrement();
+}
+
+void
+BackprojectTable::PostProcessing()
+{
+  if (! m_bPostProcessingDone) {
+    ScaleImageByRotIncrement();
+    m_bPostProcessingDone = true;
+  }
 }
 
 void
 }
 
 void
@@ -451,11 +472,18 @@ BackprojectDiff::BackprojectDiff (const Projections& proj, ImageFile& im, int in
   im.arrayDataClear();
 }
 
   im.arrayDataClear();
 }
 
-BackprojectDiff::~BackprojectDiff()
+BackprojectDiff::~BackprojectDiff ()
 {
 {
-  ScaleImageByRotIncrement();
 }
 
 }
 
+void
+BackprojectDiff::PostProcessing()
+{
+  if (! m_bPostProcessingDone) {
+    ScaleImageByRotIncrement();
+    m_bPostProcessingDone = true;
+  }
+}
 
 void
 BackprojectDiff::BackprojectView (const double* const filteredProj, const double view_angle)
 
 void
 BackprojectDiff::BackprojectView (const double* const filteredProj, const double view_angle)
index 7bc6a833c6b39b873c3711315f25bcf93ccf6411..c11820f3264149020a00f8df7ab5876791f948ae 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: reconstruct.cpp,v 1.13 2001/02/20 04:48:45 kevin Exp $
+**  $Id: reconstruct.cpp,v 1.14 2001/02/23 02:06:01 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
 **
 **  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
@@ -139,7 +139,13 @@ void
 Reconstructor::reconstructAllViews ()
 {
   reconstructView (0, m_rProj.nView());
 Reconstructor::reconstructAllViews ()
 {
   reconstructView (0, m_rProj.nView());
-  delete m_pBackprojector; m_pBackprojector = NULL;
+  postProcessing();
+}
+
+void
+Reconstructor::postProcessing()
+{
+  m_pBackprojector->PostProcessing();
 }
 
 
 }
 
 
index 7e652fce83ad2c9255ca7b6cdf0b628ae0b7c217..5b1d86856babadba1378f467f6081f24957a51cc 100644 (file)
@@ -6,26 +6,26 @@
 --------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
 --------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP84D.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP58.tmp" with contents
 [
 /nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.0.4\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
 "C:\ctsim\src\backgroundmgr.cpp"
 ]
 [
 /nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.0.4\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
 "C:\ctsim\src\backgroundmgr.cpp"
 ]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP84D.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP84E.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP58.tmp" 
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP59.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 /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib" 
 [
 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 /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib" 
+.\Debug\backgroundmgr.obj
 .\Debug\ctsim.obj
 .\Debug\dialogs.obj
 .\Debug\dlgprojections.obj
 .\Debug\dlgreconstruct.obj
 .\Debug\docs.obj
 .\Debug\graph3dview.obj
 .\Debug\ctsim.obj
 .\Debug\dialogs.obj
 .\Debug\dlgprojections.obj
 .\Debug\dlgreconstruct.obj
 .\Debug\docs.obj
 .\Debug\graph3dview.obj
+.\Debug\threadrecon.obj
+.\Debug\tips.obj
 .\Debug\views.obj
 .\Debug\ctsim.res
 .\Debug\views.obj
 .\Debug\ctsim.res
-.\Debug\tips.obj
-.\Debug\threadrecon.obj
-.\Debug\backgroundmgr.obj
 \ctsim\msvc\libctsim\Debug\libctsim.lib
 "\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib"
 "\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib"
 \ctsim\msvc\libctsim\Debug\libctsim.lib
 "\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib"
 "\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib"
@@ -36,7 +36,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
 ]
 \wx2.2.5\lib\zlibd.lib
 \wx2.2.5\lib\tiffd.lib
 ]
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP84E.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP59.tmp"
 <h3>Output Window</h3>
 Compiling...
 backgroundmgr.cpp
 <h3>Output Window</h3>
 Compiling...
 backgroundmgr.cpp
index 32c32a6e0f6ce7f6f9da7ac4a76fab1f83e07ab8..e915624bf7fe00db1bb17b3b7312a168a74170ce 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundmgr.cpp,v 1.2 2001/02/22 18:22:40 kevin Exp $
+**  $Id: backgroundmgr.cpp,v 1.3 2001/02/23 02:06:02 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
 **
 **  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
@@ -50,13 +50,18 @@ EVT_CLOSE(BackgroundManager::OnCloseWindow)
 END_EVENT_TABLE()
 
 BackgroundManager::BackgroundManager ()
 END_EVENT_TABLE()
 
 BackgroundManager::BackgroundManager ()
-  : wxMiniFrame (theApp->getMainFrame(), -1, _T("Background Tasks"), wxPoint(0,0), wxSize(200, 100)) //, wxTHICK_FRAME)
+  : wxMiniFrame (theApp->getMainFrame(), -1, _T("Background Tasks"), wxPoint(0,0), wxSize(210, 50)) //, wxTHICK_FRAME)
 {
   m_iNumTasks = 0;
   m_pCanvas = new BackgroundManagerCanvas (this);
   theApp->setIconForFrame (this);
 
 {
   m_iNumTasks = 0;
   m_pCanvas = new BackgroundManagerCanvas (this);
   theApp->setIconForFrame (this);
 
-   Show(false);
+  m_sizeGauge.Set (50, 15);
+  m_sizeLabel.Set (140, 15);
+  m_sizeCell.Set (200, 25);
+  m_sizeBorder.Set (4, 4);
+
+  Show(false);
 }
 
 
 }
 
 
@@ -75,16 +80,37 @@ BackgroundManager::addTask (BackgroundTask* pTask, int iNumUnits, const char* co
 {
   wxCriticalSectionLocker locker (m_criticalSection);
   int iNumTasks = m_vecpBackgroundTasks.size();
 {
   wxCriticalSectionLocker locker (m_criticalSection);
   int iNumTasks = m_vecpBackgroundTasks.size();
-  int iTaskHeight = 20;
-  wxSize size (50, 10);
-  wxPoint pos (4, 5 + iNumTasks * iTaskHeight);
+  std::vector<bool> vecPositionUsed (iNumTasks);
+  int i;
+  for (i = 0; i < iNumTasks; i++)
+    vecPositionUsed[i] = false;
+
+  for (i = 0; i < iNumTasks; i++) {
+    int iPosUsed = m_vecpPositions[i];
+    if (iPosUsed < iNumTasks)
+      vecPositionUsed[iPosUsed] = true;
+  }
+
+  int iFirstUnusedPos = iNumTasks;  // default is just past current number of tasks
+  for (i = 0; i < iNumTasks; i++)
+    if (! vecPositionUsed[i]) {
+      iFirstUnusedPos = i;
+      break;
+    }
+
+  wxPoint posGauge (m_sizeBorder.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y);
+  wxPoint posLabel (m_sizeBorder.x + m_sizeGauge.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y);
+  wxGauge* pGauge = new wxGauge (m_pCanvas, -1, iNumUnits, posGauge, m_sizeGauge);
+  wxStaticText* pLabel = new wxStaticText (m_pCanvas, -1, pszTaskName, posLabel, m_sizeLabel);
 
 
-  wxGauge* pGauge = new wxGauge (m_pCanvas, -1, iNumUnits, pos, size);
   m_vecpBackgroundTasks.push_back (pTask);
   m_vecpGauges.push_back (pGauge);
   m_vecpNames.push_back (new std::string (pszTaskName));
   m_vecpBackgroundTasks.push_back (pTask);
   m_vecpGauges.push_back (pGauge);
   m_vecpNames.push_back (new std::string (pszTaskName));
+  m_vecpPositions.push_back (iFirstUnusedPos);
+  m_vecpLabels.push_back (pLabel);
   m_iNumTasks++;
 
   m_iNumTasks++;
 
+  resizeWindow();
   Show(true);
   return (pGauge);
 }
   Show(true);
   return (pGauge);
 }
@@ -93,32 +119,52 @@ BackgroundManager::addTask (BackgroundTask* pTask, int iNumUnits, const char* co
 void 
 BackgroundManager::taskDone (BackgroundTask* pTask)
 {
 void 
 BackgroundManager::taskDone (BackgroundTask* pTask)
 {
-  wxCriticalSection doneSection;
-  doneSection.Enter();
+  wxCriticalSectionLocker locker (m_criticalSection);
 
   StringContainer::iterator iName = m_vecpNames.begin();
   GaugeContainer::iterator iGauge = m_vecpGauges.begin();
 
   StringContainer::iterator iName = m_vecpNames.begin();
   GaugeContainer::iterator iGauge = m_vecpGauges.begin();
+  PositionContainer::iterator iPosition = m_vecpPositions.begin();
+  LabelContainer::iterator iLabel = m_vecpLabels.begin();
   for (TaskContainer::iterator iTask = m_vecpBackgroundTasks.begin(); iTask != m_vecpBackgroundTasks.end(); iTask++) {
     if (*iTask == pTask) {
       delete *iName;
       delete *iGauge;
   for (TaskContainer::iterator iTask = m_vecpBackgroundTasks.begin(); iTask != m_vecpBackgroundTasks.end(); iTask++) {
     if (*iTask == pTask) {
       delete *iName;
       delete *iGauge;
+      delete *iLabel;
       m_vecpBackgroundTasks.erase (iTask);
       m_vecpGauges.erase (iGauge);
       m_vecpNames.erase (iName);
       m_vecpBackgroundTasks.erase (iTask);
       m_vecpGauges.erase (iGauge);
       m_vecpNames.erase (iName);
+      m_vecpPositions.erase (iPosition);
+      m_vecpLabels.erase (iLabel);
       m_iNumTasks--;
       break;
     }
       m_iNumTasks--;
       break;
     }
-    iTask++;
+    iName++;
     iGauge++;
     iGauge++;
+    iPosition++;
+    iLabel++;
   }
 
   }
 
-  doneSection.Leave();
+  resizeWindow();
   if (m_iNumTasks <= 0)
     Show(false);
   if (m_iNumTasks <= 0)
     Show(false);
+ // delete pTask;
+}
+
+void
+BackgroundManager::resizeWindow()
+{
+  int iHighestPosition = -1;
+
+  for (int i = 0; i < m_vecpPositions.size(); i++)
+    if (iHighestPosition < m_vecpPositions[i])
+      iHighestPosition = m_vecpPositions[i];
+
+  wxSize sizeWindow (m_sizeCell.x, m_sizeCell.y * (iHighestPosition + 1));
+  SetClientSize (sizeWindow);
   m_pCanvas->Refresh();
   m_pCanvas->Refresh();
-  // delete pTask;
 }
 
 }
 
+
 bool
 BackgroundManager::isCancelling (BackgroundTask* pTask)
 {
 bool
 BackgroundManager::isCancelling (BackgroundTask* pTask)
 {
index 3a91537c8a6610071a84b0291e470ed874343bce..d3f49a1304541b6f26361559ffe82f3e9865f3b2 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundmgr.h,v 1.2 2001/02/22 18:22:40 kevin Exp $
+**  $Id: backgroundmgr.h,v 1.3 2001/02/23 02:06:02 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
 **
 **  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
@@ -66,11 +66,19 @@ private:
   typedef std::vector<BackgroundTask*> TaskContainer;
   typedef std::vector<wxGauge*>  GaugeContainer;
   typedef std::vector<std::string*> StringContainer;
   typedef std::vector<BackgroundTask*> TaskContainer;
   typedef std::vector<wxGauge*>  GaugeContainer;
   typedef std::vector<std::string*> StringContainer;
+  typedef std::vector<int> PositionContainer;
+  typedef std::vector<wxStaticText*>  LabelContainer;
   TaskContainer m_vecpBackgroundTasks;
   GaugeContainer m_vecpGauges;
   StringContainer m_vecpNames;
   TaskContainer m_vecpBackgroundTasks;
   GaugeContainer m_vecpGauges;
   StringContainer m_vecpNames;
+  PositionContainer m_vecpPositions;
+  LabelContainer m_vecpLabels;
+  wxSize m_sizeGauge;
+  wxSize m_sizeLabel;
+  wxSize m_sizeCell;
+  wxSize m_sizeBorder;
 
 
-  void OnCloseWindow(wxCloseEvent& event);
+  void resizeWindow();
 
 public:
   BackgroundManager ();
 
 public:
   BackgroundManager ();
@@ -82,7 +90,11 @@ public:
   TaskContainer& getTasks() { return m_vecpBackgroundTasks;}
   GaugeContainer& getGauges() { return m_vecpGauges;}
   StringContainer& getNames() { return m_vecpNames;}
   TaskContainer& getTasks() { return m_vecpBackgroundTasks;}
   GaugeContainer& getGauges() { return m_vecpGauges;}
   StringContainer& getNames() { return m_vecpNames;}
+  PositionContainer& getPositions() { return m_vecpPositions;}
+  LabelContainer& getLabels() { return m_vecpLabels;}
 
 
+  void OnCloseWindow(wxCloseEvent& event);
+  
   DECLARE_EVENT_TABLE()
 };
 
   DECLARE_EVENT_TABLE()
 };
 
index e53daacb2458f53faa63a3f062496b1432ee755c..f973c68a1498fc6ec59ade44c586348a768a685a 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadrecon.cpp,v 1.3 2001/02/22 18:22:40 kevin Exp $
+**  $Id: threadrecon.cpp,v 1.4 2001/02/23 02:06:02 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
 **
 **  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
@@ -102,8 +102,11 @@ ThreadedReconstructor::start()
   m_pProjView->GetDocument()->addReconstructor (this);
   if (! theApp->getUseBackgroundTasks())
     m_pDialogProgress = new wxProgressDialog (_T("Filtered Backprojection"), _T("Reconstruction Progress"), m_iTotalViews, m_pProjView->getFrame(), wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
   m_pProjView->GetDocument()->addReconstructor (this);
   if (! theApp->getUseBackgroundTasks())
     m_pDialogProgress = new wxProgressDialog (_T("Filtered Backprojection"), _T("Reconstruction Progress"), m_iTotalViews, m_pProjView->getFrame(), wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
-  else
-    m_pGauge = theApp->getBackgroundManager()->addTask (this, m_iTotalViews, m_pProjView->GetFrame()->GetTitle());
+  else {
+    std::string strLabel ("Reconstructing ");
+    strLabel += m_pProjView->GetFrame()->GetTitle();
+    m_pGauge = theApp->getBackgroundManager()->addTask (this, m_iTotalViews, strLabel.c_str());
+  }
   
   m_iRunning = m_iNumThreads;
   m_iViewsDone = 0;
   
   m_iRunning = m_iNumThreads;
   m_iViewsDone = 0;
@@ -307,6 +310,7 @@ ReconstructionThread::Entry ()
     eventProgress.SetInt (RTHREAD_UNIT_COMPLETE);
     wxPostEvent (m_pSupervisor, eventProgress);
   }
     eventProgress.SetInt (RTHREAD_UNIT_COMPLETE);
     wxPostEvent (m_pSupervisor, eventProgress);
   }
+  m_pReconstructor->postProcessing();
   
   eventProgress.SetInt (m_iThread); // Send back thread# that has finished
   wxPostEvent (m_pSupervisor, eventProgress);
   
   eventProgress.SetInt (m_iThread); // Send back thread# that has finished
   wxPostEvent (m_pSupervisor, eventProgress);
index ae6f0d27bd8edbb6575cf1e9208d1c271fa31341..e9ab35ee508f627b5ef3b96d56469d05f3b7be6e 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadrecon.h,v 1.3 2001/02/22 18:22:40 kevin Exp $
+**  $Id: threadrecon.h,v 1.4 2001/02/23 02:06:02 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
 **
 **  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
 #include <wx/progdlg.h>
 #include "timer.h"
 
 #include <wx/progdlg.h>
 #include "timer.h"
 
+// This thread creates a BackgroundTask event handler object
+// The thread is detached and terminates when BackgroundTask terminates
+class BackgroundTaskThread : public wxThread {
+private:
+
+public:
+  BackgroundTaskThread();
+
+  virtual wxThread::ExitCode Entry();
+
+  // called when the thread exits - whether it terminates normally or is stopped with Delete()
+  virtual void OnExit();
+};
+
 
 class BackgroundTask : public wxEvtHandler {
 private:
 
 class BackgroundTask : public wxEvtHandler {
 private:
@@ -126,9 +140,8 @@ public:
 
   virtual wxThread::ExitCode Entry();      // thread execution starts here
 
 
   virtual wxThread::ExitCode Entry();      // thread execution starts here
 
-    // called when the thread exits - whether it terminates normally or is
-    // stopped with Delete() (but not when it is Kill()ed!)
-    virtual void OnExit();
+  // called when the thread exits - whether it terminates normally or is stopped with Delete()
+  virtual void OnExit();
 };
 
 
 };
 
 
index b8404bda75be20c0dfea8b9e5b9badc333e750d9..d8c09843ea940903d58d72b36b20d10113089477 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.113 2001/02/22 15:00:20 kevin Exp $
+**  $Id: views.cpp,v 1.114 2001/02/23 02:06:02 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
 **
 **  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
@@ -2411,6 +2411,7 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
             ::wxUsleep(50);
           }
         }
             ::wxUsleep(50);
           }
         }
+        pReconstructor->postProcessing();
         delete pDlgReconstruct;
         delete pReconstructor;
         ImageFileDocument* pReconDoc = theApp->newImageDoc();
         delete pDlgReconstruct;
         delete pReconstructor;
         ImageFileDocument* pReconDoc = theApp->newImageDoc();
@@ -2458,6 +2459,7 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event)
               return;
             }
           }
               return;
             }
           }
+          pReconstructor->postProcessing();
           delete pReconstructor;
           ImageFileDocument* pReconDoc = theApp->newImageDoc();
           if (! pReconDoc) {
           delete pReconstructor;
           ImageFileDocument* pReconDoc = theApp->newImageDoc();
           if (! pReconDoc) {
index 542f7f22131286e0f58c74ca5c9317406faaea65..bc21b489950a23314dce2bc8d8a948833a4474bf 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: pjrec.cpp,v 1.24 2001/02/16 00:28:42 kevin Exp $
+**  $Id: pjrec.cpp,v 1.25 2001/02/23 02:06:02 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
 **
 **  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
@@ -48,7 +48,7 @@ static struct option my_options[] =
   {0, 0, 0, 0}
 };
 
   {0, 0, 0, 0}
 };
 
-static const char* g_szIdStr = "$Id: pjrec.cpp,v 1.24 2001/02/16 00:28:42 kevin Exp $";
+static const char* g_szIdStr = "$Id: pjrec.cpp,v 1.25 2001/02/23 02:06:02 kevin Exp $";
 
 void 
 pjrec_usage (const char *program)
 
 void 
 pjrec_usage (const char *program)
@@ -333,7 +333,7 @@ pjrec_main (int argc, char * const argv[])
     return (1);
   }
   reconstruct.reconstructAllViews();
     return (1);
   }
   reconstruct.reconstructAllViews();
-
+  
   if (bOptVerbose)
       timerReconstruct.timerEndAndReport ("Time to reconstruct");
 
   if (bOptVerbose)
       timerReconstruct.timerEndAndReport ("Time to reconstruct");