r571: no message
[ctsim.git] / src / threadrecon.h
diff --git a/src/threadrecon.h b/src/threadrecon.h
new file mode 100644 (file)
index 0000000..53368fa
--- /dev/null
@@ -0,0 +1,115 @@
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+**   Name:          threadrecon.h
+**   Purpose:       Header file for thread reconstructions
+**   Programmer:    Kevin Rosenberg
+**   Date Started:  February 2001
+**
+**  This is part of the CTSim program
+**  Copyright (C) 1983-2001 Kevin Rosenberg
+**
+**  $Id: threadrecon.h,v 1.1 2001/02/22 11:05:38 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
+**  published by the Free Software Foundation.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with this program; if not, write to the Free Software
+**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+******************************************************************************/
+
+#ifndef _THREADRECON_H
+#define _THREADRECON_H
+
+#include <vector>
+#include <wx/thread.h>
+#include <wx/progdlg.h>
+#include "timer.h"
+
+
+class Reconstructor;
+class ImageFile;
+class ProjectionFileDocument;
+class ReconstructionThread;
+class ProjectionFileView;
+
+class ThreadedReconstructor : public wxEvtHandler {
+private:
+  DECLARE_DYNAMIC_CLASS(ThreadedReconstructor)
+
+  std::vector<Reconstructor*> m_vecpReconstructor;
+  std::vector<ImageFile*> m_vecpChildImageFile;
+  std::vector<ReconstructionThread*> m_vecpThread;
+  ProjectionFileView* m_pProjView;
+  wxProgressDialog* m_pDialogProgress;
+  
+  volatile bool m_bFail;
+  int m_iNumThreads;
+  const int m_iImageNX;
+  const int m_iImageNY;
+  volatile int m_iRunning;
+  volatile unsigned int m_iViewsDone;
+  volatile unsigned int m_iTotalViews;
+  wxCriticalSection m_criticalSection;
+  wxString m_strLabel;
+  Timer* m_pTimer;
+  bool m_bCancelled;
+  bool m_bCancelling;
+  bool m_bDone;
+
+public:
+   ThreadedReconstructor (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);
+
+   ThreadedReconstructor ()
+     : m_bFail(true), m_iNumThreads(0), m_iImageNX(0), m_iImageNY(0), m_iTotalViews(0)
+   {}
+
+   ~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;}
+
+  ImageFile* getImageFile() const;
+
+  DECLARE_EVENT_TABLE()
+};
+
+
+
+class ReconstructionThread : public wxThread {
+private:
+  ThreadedReconstructor* m_pSupervisor;
+  Reconstructor* m_pReconstructor;
+  int m_iStartView;
+  int m_iNumViews;
+  int m_iThread;
+
+public:
+  ReconstructionThread (ThreadedReconstructor* pSupervisor, Reconstructor* pReconstructor, 
+    int iThread, int iStartView, int iNumViews);
+
+  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();
+};
+
+
+#endif