r573: no message
authorKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 22 Feb 2001 18:22:40 +0000 (18:22 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 22 Feb 2001 18:22:40 +0000 (18:22 +0000)
17 files changed:
include/backprojectors.h
include/filter.h
include/procsignal.h
include/projections.h
libctsim/backprojectors.cpp
libctsim/filter.cpp
libctsim/procsignal.cpp
libctsim/projections.cpp
msvc/ctsim.dsw
msvc/ctsim/ctsim.dsp
msvc/ctsim/ctsim.plg
src/backgroundmgr.cpp
src/backgroundmgr.h
src/dialogs.cpp
src/dialogs.h
src/threadrecon.cpp
src/threadrecon.h

index 8fbb06b86382652f2af15fbc3cefd328ef646120..bd30b9cf47c0a4739da2f301e023505506d0f26f 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backprojectors.h,v 1.21 2001/02/11 04:56:37 kevin Exp $
+**  $Id: backprojectors.h,v 1.22 2001/02/22 18:22:40 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
@@ -69,15 +69,15 @@ class Backprojector
   const std::string& failMessage() const {return m_failMessage;}
 
   static const int getBackprojectCount() {return s_iBackprojectCount;}
-  static const char** getBackprojectNameArray() {return s_aszBackprojectName;}
-  static const char** getBackprojectTitleArray() {return s_aszBackprojectTitle;}
+  static const char* const* getBackprojectNameArray() {return s_aszBackprojectName;}
+  static const char* const* getBackprojectTitleArray() {return s_aszBackprojectTitle;}
   static int convertBackprojectNameToID (const char* const bprojName);
   static const char* convertBackprojectIDToName (const int bprojID);
   static const char* convertBackprojectIDToTitle (const int bprojID);
 
   static const int getInterpCount() {return s_iInterpCount;}
-  static const char** getInterpNameArray() {return s_aszInterpName;}
-  static const char** getInterpTitleArray() {return s_aszInterpTitle;}
+  static const char* const * getInterpNameArray() {return s_aszInterpName;}
+  static const char* const * getInterpTitleArray() {return s_aszInterpTitle;}
   static int convertInterpNameToID (const char* const interpName);
   static const char* convertInterpIDToName (const int interpID);
   static const char* convertInterpIDToTitle (const int interpID);
@@ -92,12 +92,12 @@ class Backprojector
   bool m_fail;
   std::string m_failMessage;
 
-  static const char* s_aszBackprojectName[];
-  static const char* s_aszBackprojectTitle[];
+  static const char* const s_aszBackprojectName[];
+  static const char* const s_aszBackprojectTitle[];
   static const int s_iBackprojectCount;
 
-  static const char* s_aszInterpName[];
-  static const char* s_aszInterpTitle[];
+  static const char* const s_aszInterpName[];
+  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);
index 8aa4018970caa4939482bd7d42f003d557f91c39..d8444a6a972b12f750857bd48716cd373c4fe942 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: filter.h,v 1.26 2001/02/16 00:28:41 kevin Exp $
+**  $Id: filter.h,v 1.27 2001/02/22 18:22:40 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
@@ -107,15 +107,15 @@ class SignalFilter {
   static const int getFilterCount() {return s_iFilterCount;}
   static const int getReconstructFilterCount() { return s_iReconstructFilterCount; }
 
-  static const char** getFilterNameArray() {return s_aszFilterName;}
-  static const char** getFilterTitleArray() {return s_aszFilterTitle;}
+  static const char* const* getFilterNameArray() {return s_aszFilterName;}
+  static const char* const* getFilterTitleArray() {return s_aszFilterTitle;}
   static int convertFilterNameToID (const char* const filterName);
   static const char* convertFilterIDToName (const int idFilter);
   static const char* convertFilterIDToTitle (const int idFilter);
 
   static const int getDomainCount() {return s_iDomainCount;}
-  static const char** getDomainNameArray() {return s_aszDomainName;}
-  static const char** getDomainTitleArray() {return s_aszDomainTitle;}
+  static const char* const* getDomainNameArray() {return s_aszDomainName;}
+  static const char* const* getDomainTitleArray() {return s_aszDomainTitle;}
   static int convertDomainNameToID (const char* const domainName);
   static const char* convertDomainIDToName (const int idDomain);
   static const char* convertDomainIDToTitle (const int idDomain);
@@ -143,12 +143,12 @@ class SignalFilter {
     bool m_fail;
     std::string m_failMessage;
 
-    static const char* s_aszFilterName[];
-    static const char* s_aszFilterTitle[];
+    static const char* const s_aszFilterName[];
+    static const char* const s_aszFilterTitle[];
     static const int s_iFilterCount;
     static const int s_iReconstructFilterCount;
-    static const char* s_aszDomainName[];
-    static const char* s_aszDomainTitle[];
+    static const char* const s_aszDomainName[];
+    static const char* const s_aszDomainTitle[];
     static const int s_iDomainCount;
     static int N_INTEGRAL;
 
index 798bfc9cb97fbd8c9cc9d65a44b15137bc71bb01..3448baed12f5ceea360d03b3cd1590a6354c372d 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: procsignal.h,v 1.13 2001/01/28 19:10:18 kevin Exp $
+**  $Id: procsignal.h,v 1.14 2001/02/22 18:22:40 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
@@ -87,15 +87,15 @@ class ProcessSignal {
     const int idFilterGeneration() const { return m_idFilterGeneration;}
 
     static const int getFilterGenerationCount() {return s_iFilterGenerationCount;}
-    static const char** getFilterGenerationNameArray() {return s_aszFilterGenerationName;}
-    static const char** getFilterGenerationTitleArray() {return s_aszFilterGenerationTitle;}
+    static const char* const* getFilterGenerationNameArray() {return s_aszFilterGenerationName;}
+    static const char* const* getFilterGenerationTitleArray() {return s_aszFilterGenerationTitle;}
     static int convertFilterGenerationNameToID (const char* const fgName);
     static const char* convertFilterGenerationIDToName (const int idFG);
     static const char* convertFilterGenerationIDToTitle (const int idFG);
   
     static const int getFilterMethodCount() {return s_iFilterMethodCount;}
-    static const char** getFilterMethodNameArray() {return s_aszFilterMethodName;}
-    static const char** getFilterMethodTitleArray() {return s_aszFilterMethodTitle;}
+    static const char* const* getFilterMethodNameArray() {return s_aszFilterMethodName;}
+    static const char* const* getFilterMethodTitleArray() {return s_aszFilterMethodTitle;}
     static int convertFilterMethodNameToID (const char* const filterMethodName);
     static const char* convertFilterMethodIDToName (const int idFilterMethod);
     static const char* convertFilterMethodIDToTitle (const int idFilterMethod);
@@ -139,11 +139,11 @@ class ProcessSignal {
     bool m_fail;
     std::string m_failMessage;
 
-    static const char* s_aszFilterMethodName[];
-    static const char* s_aszFilterMethodTitle[];
+    static const char* const s_aszFilterMethodName[];
+    static const char* const s_aszFilterMethodTitle[];
     static const int s_iFilterMethodCount;
-    static const char* s_aszFilterGenerationName[];
-    static const char* s_aszFilterGenerationTitle[];
+    static const char* const s_aszFilterGenerationName[];
+    static const char* const s_aszFilterGenerationTitle[];
     static const int s_iFilterGenerationCount;
 
 #ifdef HAVE_FFTW
index 35325dfe370ca34e1f0b5227d4819e2aae17680a..787f325b34b7729328c04d90000da4c69ebe033e 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: projections.h,v 1.24 2001/02/20 17:44:14 kevin Exp $
+**  $Id: projections.h,v 1.25 2001/02/22 18:22:40 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -54,8 +54,8 @@ class Projections
   ~Projections ();
 
   static const int getInterpCount() {return s_iInterpCount;}
-  static const char** getInterpNameArray() {return s_aszInterpName;}
-  static const char** getInterpTitleArray() {return s_aszInterpTitle;}
+  static const char* const* getInterpNameArray() {return s_aszInterpName;}
+  static const char* const* getInterpTitleArray() {return s_aszInterpTitle;}
   static int convertInterpNameToID (const char* const interpName);
   static const char* convertInterpIDToName (const int interpID);
   static const char* convertInterpIDToTitle (const int interpID);
@@ -144,8 +144,8 @@ class Projections
 
   const static kuint16 m_signature;
 
-  static const char* s_aszInterpName[];
-  static const char* s_aszInterpTitle[];
+  static const char* const s_aszInterpName[];
+  static const char* const s_aszInterpTitle[];
   static const int s_iInterpCount;
 
   bool headerWrite (fnetorderstream& fs);
index c7a8f27f47f7bd34b1523af9d852760ff967cf35..ebfe2a4358326b16aafafb2b30ef8fe84b3240f9 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backprojectors.cpp,v 1.26 2001/02/11 04:56:37 kevin Exp $
+**  $Id: backprojectors.cpp,v 1.27 2001/02/22 18:22:40 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
@@ -32,7 +32,7 @@ const int Backprojector::BPROJ_TABLE = 1;
 const int Backprojector::BPROJ_DIFF = 2;
 const int Backprojector::BPROJ_IDIFF = 3;
 
-const char* Backprojector::s_aszBackprojectName[] = 
+const char* const Backprojector::s_aszBackprojectName[] = 
 {
   {"trig"},
   {"table"},
@@ -40,7 +40,7 @@ const char* Backprojector::s_aszBackprojectName[] =
   {"idiff"},
 };
 
-const char* Backprojector::s_aszBackprojectTitle[] = 
+const char* const Backprojector::s_aszBackprojectTitle[] = 
 {
   {"Direct Trigometric"},
   {"Trigometric Table"},
@@ -62,7 +62,7 @@ const int Backprojector::INTERP_2BSPLINE = 6;
 const int Backprojector::INTERP_3BSPLINE = 7;
 #endif
 
-const char* Backprojector::s_aszInterpName[] = 
+const char* const Backprojector::s_aszInterpName[] = 
 {
   {"nearest"},
   {"linear"},
@@ -78,7 +78,7 @@ const char* Backprojector::s_aszInterpName[] =
 #endif
 };
 
-const char* Backprojector::s_aszInterpTitle[] = 
+const char* const Backprojector::s_aszInterpTitle[] = 
 {
   {"Nearest"},
   {"Linear"},
index 85e07e09b273bffd4bfa58903e7d108771450eb1..f86478653bbf4d93a814c66a51db717b93d289be 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2000 Kevin Rosenberg
 **
-**  $Id: filter.cpp,v 1.37 2001/02/16 00:28:41 kevin Exp $
+**  $Id: filter.cpp,v 1.38 2001/02/22 18:22:40 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
@@ -45,7 +45,7 @@ const int SignalFilter::FILTER_TRIANGLE = 11;
 
 const int SignalFilter::s_iReconstructFilterCount = 4;
 
-const char* SignalFilter::s_aszFilterName[] = {
+const char* const SignalFilter::s_aszFilterName[] = {
   {"abs_bandlimit"},
   {"abs_hamming"},
   {"abs_hanning"},
@@ -60,7 +60,7 @@ const char* SignalFilter::s_aszFilterName[] = {
   {"triangle"},
 };
 
-const char* SignalFilter::s_aszFilterTitle[] = {
+const char* const SignalFilter::s_aszFilterTitle[] = {
   {"Abs(w) * Bandlimit"},
   {"Abs(w) * Hamming"},
   {"Abs(w) * Hanning"},
@@ -82,12 +82,12 @@ const int SignalFilter::DOMAIN_INVALID = -1;
 const int SignalFilter::DOMAIN_FREQUENCY = 0;
 const int SignalFilter::DOMAIN_SPATIAL = 1;
     
-const char* SignalFilter::s_aszDomainName[] = {
+const char* const SignalFilter::s_aszDomainName[] = {
   {"frequency"},
   {"spatial"},
 };
 
-const char* SignalFilter::s_aszDomainTitle[] = {
+const char* const SignalFilter::s_aszDomainTitle[] = {
   {"Frequency"},
   {"Spatial"},
 };
index 707ee382b96dbc75412ad35115a00c9950dc3830..b5c6678c2d6c0c605032d2d3d219353d4d521a84 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: procsignal.cpp,v 1.25 2001/02/11 04:56:37 kevin Exp $
+**  $Id: procsignal.cpp,v 1.26 2001/02/22 18:22:40 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
@@ -41,7 +41,7 @@ const int ProcessSignal::FILTER_METHOD_FFT = 3;
 const int ProcessSignal::FILTER_METHOD_FFTW = 4;
 const int ProcessSignal::FILTER_METHOD_RFFTW =5 ;
 #endif
-const char* ProcessSignal::s_aszFilterMethodName[] = {
+const char* const ProcessSignal::s_aszFilterMethodName[] = {
   {"convolution"},
   {"fourier"},
   {"fouier-table"},
@@ -51,7 +51,7 @@ const char* ProcessSignal::s_aszFilterMethodName[] = {
   {"rfftw"},
 #endif
 };
-const char* ProcessSignal::s_aszFilterMethodTitle[] = {
+const char* const ProcessSignal::s_aszFilterMethodTitle[] = {
   {"Convolution"},
   {"Fourier"},
   {"Fouier Trigometric Table"},
@@ -67,11 +67,11 @@ const int ProcessSignal::s_iFilterMethodCount = sizeof(s_aszFilterMethodName) /
 const int ProcessSignal::FILTER_GENERATION_INVALID = -1;
 const int ProcessSignal::FILTER_GENERATION_DIRECT = 0;
 const int ProcessSignal::FILTER_GENERATION_INVERSE_FOURIER = 1;
-const char* ProcessSignal::s_aszFilterGenerationName[] = {
+const char* const ProcessSignal::s_aszFilterGenerationName[] = {
   {"direct"},
   {"inverse-fourier"},
 };
-const char* ProcessSignal::s_aszFilterGenerationTitle[] = {
+const char* const ProcessSignal::s_aszFilterGenerationTitle[] = {
   {"Direct"},
   {"Inverse Fourier"},
 };
index d80579e5f897ab0ea3d17372dd5ed6d5fd5fecdd..e9e053d96cd0d19b357fa2efe2b5125ff465a07c 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: projections.cpp,v 1.48 2001/02/20 17:44:14 kevin Exp $
+**  $Id: projections.cpp,v 1.49 2001/02/22 18:22:40 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
@@ -33,14 +33,14 @@ const int Projections::POLAR_INTERP_NEAREST = 0;
 const int Projections::POLAR_INTERP_BILINEAR = 1;
 const int Projections::POLAR_INTERP_BICUBIC = 2;
 
-const char* Projections::s_aszInterpName[] = 
+const char* const Projections::s_aszInterpName[] = 
 {
   {"nearest"},
   {"bilinear"},
 //  {"bicubic"},
 };
 
-const char* Projections::s_aszInterpTitle[] = 
+const char* const Projections::s_aszInterpTitle[] = 
 {
   {"Nearest"},
   {"Bilinear"},
index 178ee44c508818a608b39d4d387acf016dce4622..3d7b7bae7a4e6095daa35fd5d4d21047f3495936 100644 (file)
@@ -51,6 +51,18 @@ Package=<4>
 
 ###############################################################################
 
+Project: "ThreadVC"=..\..\wx2.2.5\samples\thread\ThreadVC.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
 Project: "ctsim"=.\ctsim\ctsim.dsp - Package Owner=<4>
 
 Package=<5>
index 96795534bd3e6cd8393a3b529bc21656c6d9b989..fb1cdcc70ef16ecf2d070f5b53390a6a549841ce 100644 (file)
@@ -93,6 +93,10 @@ LINK32=link.exe
 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
 # Begin Source File
 
+SOURCE=..\..\src\backgroundmgr.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\src\ctsim.cpp
 # ADD CPP /D CTSIMVERSION=\"3.0.0alpha5\"
 # End Source File
@@ -132,6 +136,14 @@ SOURCE=..\..\src\graph3dview.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\src\threadrecon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\tips.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\src\views.cpp
 # ADD CPP /D CTSIMVERSION=\"3.0.0alpha5\"
 # End Source File
@@ -141,6 +153,10 @@ SOURCE=..\..\src\views.cpp
 # PROP Default_Filter "h;hpp;hxx;hm;inl"
 # Begin Source File
 
+SOURCE=..\..\src\backgroundmgr.h
+# End Source File
+# Begin Source File
+
 SOURCE="..\..\src\ctsim-map.h"
 # End Source File
 # Begin Source File
@@ -173,6 +189,14 @@ SOURCE=..\..\src\splash.xpm
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\src\threadrecon.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\tips.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\src\views.h
 # End Source File
 # End Group
index 05c22399324d45ff040263b90979e346b67b4e21..7e652fce83ad2c9255ca7b6cdf0b628ae0b7c217 100644 (file)
@@ -3,80 +3,16 @@
 <pre>
 <h1>Build Log</h1>
 <h3>
---------------------Configuration: libctsim - Win32 Debug--------------------
-</h3>
-<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75C.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" /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 /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
-"C:\ctsim\libctgraphics\dlgezplot.cpp"
-"C:\ctsim\libctsim\globalvars.cpp"
-"C:\ctsim\libctsupport\syserror.cpp"
-]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75C.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75D.tmp" with contents
-[
-/nologo /out:"Debug\libctsim.lib" 
-.\Debug\array2dfile.obj
-.\Debug\backprojectors.obj
-.\Debug\clip.obj
-.\Debug\consoleio.obj
-.\Debug\dlgezplot.obj
-.\Debug\ezplot.obj
-.\Debug\ezset.obj
-.\Debug\ezsupport.obj
-.\Debug\filter.obj
-.\Debug\fnetorderstream.obj
-.\Debug\fourier.obj
-.\Debug\getopt.obj
-.\Debug\getopt1.obj
-.\Debug\globalvars.obj
-.\Debug\hashtable.obj
-.\Debug\imagefile.obj
-.\Debug\interpolator.obj
-.\Debug\mathfuncs.obj
-.\Debug\phantom.obj
-.\Debug\plotfile.obj
-.\Debug\pol.obj
-.\Debug\procsignal.obj
-.\Debug\projections.obj
-.\Debug\reconstruct.obj
-.\Debug\scanner.obj
-.\Debug\sgp.obj
-.\Debug\strfuncs.obj
-.\Debug\syserror.obj
-.\Debug\trace.obj
-.\Debug\transformmatrix.obj
-.\Debug\xform.obj
-]
-Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75D.tmp"
-<h3>Output Window</h3>
-Compiling...
-dlgezplot.cpp
-Skipping... (no relevant changes detected)
-globalvars.cpp
-syserror.cpp
-Creating library...
-<h3>
 --------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75E.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\" /D CTSIMVERSION=\"3.0.0alpha5\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
-"C:\ctsim\src\ctsim.cpp"
-"C:\ctsim\src\dialogs.cpp"
-"C:\ctsim\src\docs.cpp"
-"C:\ctsim\src\views.cpp"
-]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75E.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75F.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP84D.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\graph3dview.cpp"
+"C:\ctsim\src\backgroundmgr.cpp"
 ]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP75F.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP760.tmp" with contents
+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
 [
 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\ctsim.obj
@@ -100,25 +36,11 @@ 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\RSP760.tmp"
-<h3>Output Window</h3>
-Compiling...
-ctsim.cpp
-dialogs.cpp
-docs.cpp
-views.cpp
-Compiling...
-graph3dview.cpp
-Linking...
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP763.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"
-]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP763.tmp" 
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP84E.tmp"
 <h3>Output Window</h3>
 Compiling...
 backgroundmgr.cpp
+Linking...
 
 
 
index 12d337df3ff5ea52982b002b4e12aeaae685b220..32c32a6e0f6ce7f6f9da7ac4a76fab1f83e07ab8 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundmgr.cpp,v 1.1 2001/02/22 15:00:20 kevin Exp $
+**  $Id: backgroundmgr.cpp,v 1.2 2001/02/22 18:22:40 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
@@ -56,9 +56,7 @@ BackgroundManager::BackgroundManager ()
   m_pCanvas = new BackgroundManagerCanvas (this);
   theApp->setIconForFrame (this);
 
-  Show(true);
- // if (m_iNumTasks == 0)
- //   Show(false);
+   Show(false);
 }
 
 
@@ -73,14 +71,21 @@ BackgroundManager::OnCloseWindow (wxCloseEvent& event)
 
 
 wxGauge* 
-BackgroundManager::addTask (BackgroundTask* pTask, int iNumUnits)
+BackgroundManager::addTask (BackgroundTask* pTask, int iNumUnits, const char* const pszTaskName)
 {
+  wxCriticalSectionLocker locker (m_criticalSection);
+  int iNumTasks = m_vecpBackgroundTasks.size();
+  int iTaskHeight = 20;
   wxSize size (50, 10);
-  wxPoint pos (4, 5);
+  wxPoint pos (4, 5 + iNumTasks * iTaskHeight);
 
   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_iNumTasks++;
+
+  Show(true);
   return (pGauge);
 }
 
@@ -88,7 +93,30 @@ BackgroundManager::addTask (BackgroundTask* pTask, int iNumUnits)
 void 
 BackgroundManager::taskDone (BackgroundTask* pTask)
 {
-  m_iNumTasks--;
+  wxCriticalSection doneSection;
+  doneSection.Enter();
+
+  StringContainer::iterator iName = m_vecpNames.begin();
+  GaugeContainer::iterator iGauge = m_vecpGauges.begin();
+  for (TaskContainer::iterator iTask = m_vecpBackgroundTasks.begin(); iTask != m_vecpBackgroundTasks.end(); iTask++) {
+    if (*iTask == pTask) {
+      delete *iName;
+      delete *iGauge;
+      m_vecpBackgroundTasks.erase (iTask);
+      m_vecpGauges.erase (iGauge);
+      m_vecpNames.erase (iName);
+      m_iNumTasks--;
+      break;
+    }
+    iTask++;
+    iGauge++;
+  }
+
+  doneSection.Leave();
+  if (m_iNumTasks <= 0)
+    Show(false);
+  m_pCanvas->Refresh();
+  // delete pTask;
 }
 
 bool
index 7e95fae7b75daf75938363ee304c8292c9718e6a..3a91537c8a6610071a84b0291e470ed874343bce 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundmgr.h,v 1.1 2001/02/22 15:00:20 kevin Exp $
+**  $Id: backgroundmgr.h,v 1.2 2001/02/22 18:22:40 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
@@ -59,20 +59,30 @@ class BackgroundManager : public wxMiniFrame
 private:
   DECLARE_DYNAMIC_CLASS(BackgroundManager)
 
+  wxCriticalSection m_criticalSection;
   BackgroundManagerCanvas* m_pCanvas;
   int m_iNumTasks;
-  std::vector<BackgroundTask*> m_vecpBackgroundTasks;
-  std::vector<wxGauge*> m_vecpGauges;
+
+  typedef std::vector<BackgroundTask*> TaskContainer;
+  typedef std::vector<wxGauge*>  GaugeContainer;
+  typedef std::vector<std::string*> StringContainer;
+  TaskContainer m_vecpBackgroundTasks;
+  GaugeContainer m_vecpGauges;
+  StringContainer m_vecpNames;
 
   void OnCloseWindow(wxCloseEvent& event);
 
 public:
   BackgroundManager ();
 
-  wxGauge* addTask (BackgroundTask* pTask, int iNumUnits);
+  wxGauge* addTask (BackgroundTask* pTask, int iNumUnits, const char* const pszTaskName);
   void taskDone (BackgroundTask* pTask);
   bool isCancelling (BackgroundTask* pTask);
 
+  TaskContainer& getTasks() { return m_vecpBackgroundTasks;}
+  GaugeContainer& getGauges() { return m_vecpGauges;}
+  StringContainer& getNames() { return m_vecpNames;}
+
   DECLARE_EVENT_TABLE()
 };
 
index 21b6f197ba2ca3936371e1dc3e4af6c7e24a8955..7b4d7d141c2b514080456913d1d45ead0de750ad 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: dialogs.cpp,v 1.41 2001/02/22 15:00:20 kevin Exp $
+**  $Id: dialogs.cpp,v 1.42 2001/02/22 18:22:40 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
@@ -60,7 +60,7 @@
 //    StringValueAndTitleListBox
 ///////////////////////////////////////////////////////////////////////
 
-StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[])
+StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* const aszTitle[], const char* const aszValue[])
 : wxListBox ()
 {
   wxString* psTitle = new wxString [nChoices];
@@ -79,7 +79,7 @@ StringValueAndTitleListBox::getSelectionStringValue () const
   return m_ppszValues[GetSelection()];
 }
 
-StringValueAndTitleRadioBox::StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* aszTitle[], const char* aszValue[])
+StringValueAndTitleRadioBox::StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* const aszTitle[], const char* const aszValue[])
 : wxRadioBox ()
 {
   wxString* psTitle = new wxString [nChoices];
index 22eccf5fc24f3f3c55ae3ec7bf67f383c0129453..43167294cc35ec77f830e39cccadf25b8aeae13d 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: dialogs.h,v 1.30 2001/02/22 15:00:20 kevin Exp $
+**  $Id: dialogs.h,v 1.31 2001/02/22 18:22:40 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
@@ -56,24 +56,24 @@ public:
 class StringValueAndTitleListBox : public wxListBox
 {
  public:
-  StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[]);
+  StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* const aszTitle[], const char* const aszValue[]);
 
     const char* getSelectionStringValue () const;
 
  private:
-    const char** m_ppszValues;
+    const char* const* m_ppszValues;
 };
 
 
 class StringValueAndTitleRadioBox : public wxRadioBox
 {
  public:
-  StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* aszTitle[], const char* aszValue[]);
+  StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* const aszTitle[], const char* const aszValue[]);
 
   const char* getSelectionStringValue () const;
 
  private:
-  const char** m_ppszValues;
+  const char* const* m_ppszValues;
 };
 
 
index e43299a356cb925614cbe003a014a566f0420570..e53daacb2458f53faa63a3f062496b1432ee755c 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadrecon.cpp,v 1.2 2001/02/22 15:00:20 kevin Exp $
+**  $Id: threadrecon.cpp,v 1.3 2001/02/22 18:22:40 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
@@ -51,34 +51,34 @@ END_EVENT_TABLE()
 
 enum {
   RTHREAD_UNIT_COMPLETE = -1,
-  RTHREAD_THREAD_DONE = -2,
-  RTHREAD_THREAD_CANCELLED = -3,
+    RTHREAD_THREAD_DONE = -2,
+    RTHREAD_THREAD_CANCELLED = -3,
 };
 
 ThreadedReconstructor::ThreadedReconstructor (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)
-    : m_pProjView(pProjView), m_pDialogProgress(NULL), m_pGauge(NULL), m_bFail(false), m_iNumThreads(0), m_iImageNX(iImageNX), 
-    m_iImageNY(iImageNY), m_strLabel(pszLabel), m_pTimer(NULL), m_bCancelled(false), m_bCancelling(false), 
-    m_bDone(false), BackgroundTask()
+                                              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)
+                                              : m_pProjView(pProjView), m_pDialogProgress(NULL), m_pGauge(NULL), m_bFail(false), m_iNumThreads(0), m_iImageNX(iImageNX), 
+                                              m_iImageNY(iImageNY), m_strLabel(pszLabel), m_pTimer(NULL), m_bCancelled(false), m_bCancelling(false), 
+                                              BackgroundTask()
 {
   m_iNumThreads = theApp->getNumberCPU();
-//  ++m_iNumThreads;
+  //  ++m_iNumThreads;
   m_iTotalViews = m_pProjView->GetDocument()->getProjections().nView();
   int iBaseViews = m_iTotalViews / m_iNumThreads;
   int iExtraViews = m_iTotalViews % m_iNumThreads;
-
+  
   m_vecpChildImageFile.reserve (m_iNumThreads);
   m_vecpReconstructor.reserve (m_iNumThreads);
   m_vecpThread.reserve (m_iNumThreads);
-
+  
   for (unsigned int iProc = 0; iProc < m_iNumThreads; iProc++) {
     m_vecpChildImageFile[iProc] = new ImageFile (iImageNX, iImageNY);
     m_vecpReconstructor[iProc] = new Reconstructor (m_pProjView->GetDocument()->getProjections(), *m_vecpChildImageFile[iProc],
-    pszFilterName, dFilterParam, pszFilterMethod, iZeropad, pszFilterGenerationName, 
-    pszInterpName, iInterpParam, pszBackprojectName, Trace::TRACE_NONE);
-
+      pszFilterName, dFilterParam, pszFilterMethod, iZeropad, pszFilterGenerationName, 
+      pszInterpName, iInterpParam, pszBackprojectName, Trace::TRACE_NONE);
+    
     int iStartView = iProc * iBaseViews;
     int iNumViews = iBaseViews;
     if (iProc < iExtraViews)
@@ -89,7 +89,7 @@ ThreadedReconstructor::ThreadedReconstructor (ProjectionFileView* pProjView,
       break;
     }
   }
-
+  
 }
 
 
@@ -98,117 +98,140 @@ ThreadedReconstructor::start()
 {
   if (m_bFail)
     return false;
-
+  
   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_pGauge = theApp->getBackgroundManager()->addTask (this, m_iTotalViews, m_pProjView->GetFrame()->GetTitle());
+  
   m_iRunning = m_iNumThreads;
   m_iViewsDone = 0;
   m_pTimer = new Timer;
-
+  
   // starting all threads
   for (int i = 0; i < m_iNumThreads; i++)
     m_vecpThread[i]->Run();
-
-
+  
   if (m_bCancelled)
     return false;
-
+  
   return true;
 }
 
 void
 ThreadedReconstructor::cancel()
 {
-  if (m_bCancelled)
+  if (isDone() || m_bCancelled)
     return;
+  m_bCancelled = true;
+  m_bCancelling = false;
+  cleanUp();
+}
 
-  wxCriticalSectionLocker locker (m_criticalSection);
-
+void
+ThreadedReconstructor::cleanUp()
+{
+  wxCriticalSection cleanSection;
+  cleanSection.Enter();
+  
   for (int i = 0; i < m_iNumThreads; i++) 
-    if (m_vecpThread[i])
+    if (m_vecpThread[i] && m_vecpThread[i]->IsRunning()) {
+      m_vecpThread[i]->Pause();
       m_vecpThread[i]->Delete();
-
-  for (i = 0; i < m_iNumThreads; i++)
-    delete m_vecpReconstructor[i];
-
-  m_iNumThreads = 0;
-  m_iRunning = 0;
-  delete m_pDialogProgress;
-  delete m_pTimer;
-  m_pDialogProgress = NULL;
-  m_pProjView->GetDocument()->removeReconstructor (this);
-  m_bCancelled = true;
-  m_bDone = true;
-  theApp->getBackgroundManager()->taskDone (this);
+    }
+    
+    for (i = 0; i < m_iNumThreads; i++) {
+      delete m_vecpChildImageFile[i];
+      m_vecpChildImageFile[i] = NULL;
+    }
+    for (i = 0; i < m_iNumThreads; i++) {
+      delete m_vecpReconstructor[i];
+      m_vecpReconstructor[i] = NULL;
+    }
+    
+    
+    m_iNumThreads = 0;
+    m_iRunning = 0;
+    delete m_pDialogProgress;
+    delete m_pTimer;
+    m_pDialogProgress = NULL;
+    m_pGauge = NULL;
+    setDone();
+    m_pProjView->GetDocument()->removeReconstructor (this);
+    theApp->getBackgroundManager()->taskDone (this);
+    
+    cleanSection.Leave();
 }
 
 void
 ThreadedReconstructor::onDone()
 {
-    for (int i = 0; i < m_iNumThreads; i++)
-      delete m_vecpReconstructor[i];
+  wxCriticalSection doneSection;
+  doneSection.Enter();
 
-    m_pProjView->GetDocument()->removeReconstructor (this);
-      ImageFileDocument* pReconDoc = theApp->newImageDoc();
-      if (! pReconDoc) {
-        sys_error (ERR_SEVERE, "Unable to create image file");
-        return;
-      }
-      
-      ImageFile* pImageFile = getImageFile();
-      pReconDoc->setImageFile (pImageFile);
-      if (theApp->getAskDeleteNewDocs())
-        pReconDoc->Modify (true);
-      pReconDoc->UpdateAllViews (m_pProjView);
-      if (ImageFileView* rasterView = pReconDoc->getView()) {
-        rasterView->OnUpdate (rasterView, NULL);
-        rasterView->getFrame()->SetFocus();
-        rasterView->getFrame()->Show(true);
-      }
-      *theApp->getLog() << m_strLabel << "\n";
-      pImageFile->labelAdd (m_pProjView->GetDocument()->getProjections().getLabel());
-      pImageFile->labelAdd (m_strLabel.c_str(), m_pTimer->timerEnd());
-      delete m_pTimer;
-
-      wxIdleEvent event;
-      theApp->OnIdle(event);
-      m_bDone = true;
-   theApp->getBackgroundManager()->taskDone (this);
-      // delete this;
+  m_pProjView->GetDocument()->removeReconstructor (this);
+  ImageFileDocument* pReconDoc = theApp->newImageDoc();
+  if (! pReconDoc) {
+    sys_error (ERR_SEVERE, "Unable to create image file");
+    doneSection.Leave();
+    return;
+  }
+  
+  for (int i = 0; i < m_iNumThreads; i++) {
+    delete m_vecpReconstructor[i];
+    m_vecpReconstructor[i] = NULL;
+  }
+  
+  ImageFile* pImageFile = getImageFile();
+  pReconDoc->setImageFile (pImageFile);
+  if (theApp->getAskDeleteNewDocs())
+    pReconDoc->Modify (true);
+  pReconDoc->UpdateAllViews (m_pProjView);
+  if (ImageFileView* rasterView = pReconDoc->getView()) {
+    rasterView->OnUpdate (rasterView, NULL);
+    rasterView->getFrame()->SetFocus();
+    rasterView->getFrame()->Show(true);
+  }
+  *theApp->getLog() << m_strLabel << "\n";
+  pImageFile->labelAdd (m_pProjView->GetDocument()->getProjections().getLabel());
+  pImageFile->labelAdd (m_strLabel.c_str(), m_pTimer->timerEnd());
+  
+  doneSection.Leave();
+  cleanUp();
 }
 
 
 void
 ThreadedReconstructor::OnThreadEvent (wxCommandEvent& event)
 {
-  if (m_bCancelling) {
-    cancel();
+  if (isDone())
+    return;
+  wxCriticalSection eventSection;
+  eventSection.Enter();
+  if (isDone()) {
+    eventSection.Leave();
     return;
   }
-
-  wxCriticalSectionLocker locker (m_criticalSection);
-
+  
   int iEventId = event.GetInt();
   if (iEventId == RTHREAD_UNIT_COMPLETE) {
     ++m_iViewsDone;
-    *theApp->getLog() << "Views done: " << static_cast<int>(m_iViewsDone) <<"\n";
-
+    
+#ifdef DEBUG
+    if (theApp->getVerboseLogging())
+      *theApp->getLog() << "Views done: " << static_cast<int>(m_iViewsDone) <<"\n";
+#endif
+    
     if (m_pDialogProgress)
       m_bCancelling = ! m_pDialogProgress->Update (m_iViewsDone - 1);
     else if (m_pGauge) {
-      m_pGauge->SetValue (m_iViewsDone - 1);
+      m_pGauge->SetValue (m_iViewsDone - 1); 
+      eventSection.Leave();
       m_bCancelling = theApp->getBackgroundManager()->isCancelling(this);
     }
-    if (m_iViewsDone == m_iTotalViews) {
-      delete m_pDialogProgress;
-      m_pDialogProgress = NULL;
-      onDone();
-    }
-    if (m_bCancelling) {
+    if (! isDone() && m_bCancelling) {
+      eventSection.Leave();
       cancel();
       return;
     }
@@ -217,19 +240,25 @@ ThreadedReconstructor::OnThreadEvent (wxCommandEvent& event)
     m_iRunning--;
     m_vecpThread[event.GetInt()] = NULL;
     *theApp->getLog() << "Thread finished. Remaining threads: " << m_iRunning << "\n";
+    if (m_iRunning <= 0) {
+      eventSection.Leave();
+      onDone();
+      return;
+    }
   }
   else
     *theApp->getLog() << "Got event #" << iEventId << "\n";
-
+  
+  eventSection.Leave();
 }
 
 ImageFile*
-ThreadedReconstructor::getImageFile() const
+ThreadedReconstructor::getImageFile()
 {
   ImageFile* pImageFile = new ImageFile (m_iImageNX, m_iImageNY);
   pImageFile->arrayDataClear();
   ImageFileArray pArray = pImageFile->getArray();
+  
   int i;
   for (i = 0; i < m_iNumThreads; i++) {
     ImageFileArrayConst pChildArray = m_vecpChildImageFile[i]->getArray();
@@ -237,19 +266,14 @@ ThreadedReconstructor::getImageFile() const
       for (int iy = 0; iy < m_iImageNY; iy++)
         pArray[ix][iy] += pChildArray[ix][iy];
   }
-
-  for (i = 0; i < m_iNumThreads; i++) {
-    delete m_vecpChildImageFile[i];
-//    m_vecpChildImageFile[i] = NULL;
-  }
-
+  
   return (pImageFile);
 }
 
 bool
 ThreadedReconstructor::testDone()
 {
-    return (m_iRunning <= 0 ? true : false);
+  return (m_iRunning <= 0 ? true : false);
 }
 
 
@@ -259,35 +283,35 @@ ThreadedReconstructor::~ThreadedReconstructor()
 
 
 ReconstructionThread::ReconstructionThread (ThreadedReconstructor* pSupervisor, 
-                         Reconstructor* pReconstructor, int iThread, int iStartView, int iNumViews)
-: m_pSupervisor(pSupervisor), m_pReconstructor(pReconstructor), 
-  m_iStartView(iStartView), m_iNumViews(iNumViews), m_iThread(iThread), 
-  wxThread(wxTHREAD_DETACHED)
+                                            Reconstructor* pReconstructor, int iThread, int iStartView, int iNumViews)
+                                            : m_pSupervisor(pSupervisor), m_pReconstructor(pReconstructor), 
+                                            m_iStartView(iStartView), m_iNumViews(iNumViews), m_iThread(iThread), 
+                                            wxThread(wxTHREAD_DETACHED)
 {
 }
 
 wxThread::ExitCode
 ReconstructionThread::Entry ()
 {
-   wxCommandEvent eventProgress (wxEVT_COMMAND_MENU_SELECTED, RECONSTRUCTION_THREAD_EVENT);
-   for (int iView = 0; iView < m_iNumViews; iView++) {
-     if (TestDestroy()) {
+  wxCommandEvent eventProgress (wxEVT_COMMAND_MENU_SELECTED, RECONSTRUCTION_THREAD_EVENT);
+  for (int iView = 0; iView < m_iNumViews; iView++) {
+    if (TestDestroy()) {
       wxString msg;
       msg.Printf("TestDestroy TRUE at view #%d\n", iView);  
       wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT );
       event.SetString( msg );
       wxPostEvent( theApp->getMainFrame(), event ); // send in a thread-safe way
       return reinterpret_cast<wxThread::ExitCode>(RTHREAD_THREAD_CANCELLED);
-     }
-     m_pReconstructor->reconstructView (iView + m_iStartView, 1);
-     eventProgress.SetInt (RTHREAD_UNIT_COMPLETE);
-     wxPostEvent (m_pSupervisor, eventProgress);
-   }
-
-   eventProgress.SetInt (m_iThread); // Send back thread# that has finished
-   wxPostEvent (m_pSupervisor, eventProgress);
-
-   return reinterpret_cast<wxThread::ExitCode>(0);
+    }
+    m_pReconstructor->reconstructView (iView + m_iStartView, 1);
+    eventProgress.SetInt (RTHREAD_UNIT_COMPLETE);
+    wxPostEvent (m_pSupervisor, eventProgress);
+  }
+  
+  eventProgress.SetInt (m_iThread); // Send back thread# that has finished
+  wxPostEvent (m_pSupervisor, eventProgress);
+  
+  return reinterpret_cast<wxThread::ExitCode>(0);
 }
 
 void
index 0cb8c9a3c584c7070f82d64d84d84049912d71db..ae6f0d27bd8edbb6575cf1e9208d1c271fa31341 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: threadrecon.h,v 1.2 2001/02/22 15:00:20 kevin Exp $
+**  $Id: threadrecon.h,v 1.3 2001/02/22 18:22:40 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
 
 
 class BackgroundTask : public wxEvtHandler {
+private:
+  bool m_bDone;
+
 public:
   BackgroundTask()
-    : wxEvtHandler()
+    : m_bDone(false), wxEvtHandler()
   {}
 
   virtual ~BackgroundTask()
@@ -45,6 +48,10 @@ public:
 
   virtual void cancel() = 0;
   virtual bool start() = 0;
+  virtual bool testDone() = 0;
+
+  bool isDone() const {return m_bDone;}
+  void setDone() { m_bDone = true; }
 };
 
 class Reconstructor;
@@ -71,12 +78,11 @@ private:
   volatile int m_iRunning;
   volatile unsigned int m_iViewsDone;
   volatile unsigned int m_iTotalViews;
-  wxCriticalSection m_criticalSection;
+  //wxCriticalSection m_criticalSection;
   wxString m_strLabel;
   Timer* m_pTimer;
   bool m_bCancelled;
   bool m_bCancelling;
-  bool m_bDone;
 
 public:
    ThreadedReconstructor (ProjectionFileView* pProjView, 
@@ -91,15 +97,15 @@ public:
    ~ThreadedReconstructor ();
 
   void OnThreadEvent (wxCommandEvent& event);
-  bool testDone();
   void cancel();
 
   void onDone();
   bool start();
   bool fail() const {return m_bFail;}
-  bool getDone() const {return m_bDone;}
+  bool testDone();
+  void cleanUp();
 
-  ImageFile* getImageFile() const;
+  ImageFile* getImageFile();
 
   DECLARE_EVENT_TABLE()
 };