r101: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 19 Jun 2000 17:58:20 +0000 (17:58 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 19 Jun 2000 17:58:20 +0000 (17:58 +0000)
ChangeLog
include/ct.h
include/projections.h
include/scanner.h
libctsim/projections.cpp
libctsupport/syserror.cpp
src/Makefile.am

index 0551cc8fa80603e10976e8cec908a819c0b320e5..f426b5b6ade7b2b02ffab73be98e5609b0e2bfad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
        
 1.9.1 - 6/20/2000
    Renamed directories, moved source files, combined source files
+   to change from 6 libraries to 3 libraries (libctsim, libctsupport,
+   and libctgraphics)
        
 1.9.0 - 6/15/2000
    Skip versions to make version 2.0 the first C++ version
index 2b59b411021317b4d663bb16d35cee9e707c8ac7..c3ec83db749253da9212f8028fb08363a360bc0b 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ct.h,v 1.17 2000/06/19 15:48:23 kevin Exp $
+**  $Id: ct.h,v 1.18 2000/06/19 17:58:20 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
@@ -131,6 +131,8 @@ extern "C" {
 #include <string>
 #include <iterator>
 #include <algorithm>
+#include <exception>
+#include <stdexcept>
 
 using namespace std;
 
index bbf43054d3d1eb17b745110aaacaf4578b9efca0..c1302a9df46e5241710198be6128918e07f351d4 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: projections.h,v 1.1 2000/06/17 20:12:14 kevin Exp $
+**  $Id: projections.h,v 1.2 2000/06/19 17:58:20 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -41,7 +41,7 @@ class Projections
   Projections (void);
   ~Projections (void);
 
-  void init (const int nView, const int nDet);
+  void initFromScanner (const Scanner& scanner);
 
   void printProjectionData (void);
   void printScanInfo (void) const;
@@ -51,6 +51,7 @@ class Projections
   bool detarrayRead (DetectorArray& darray, const int view_num);
   bool detarrayWrite (const DetectorArray& darray, const int view_num);
 
+  void setNView (int nView);  // used in MPI to restrict # of views
   void setRotInc (double rotInc) { m_rotInc = rotInc;}
   void setDetInc (double detInc) { m_detInc = detInc;}
   void setPhmLen (double phmLen) { m_phmLen = phmLen;}
@@ -89,6 +90,8 @@ class Projections
   bool headerWrite (void);
   void newProjData (void);
   void deleteProjData (void);
+
+  void init (const int nView, const int nDet);
 };
 
 
index aebf7d1b814484204f613501d8022f4dad692f16..005c8028ea73d6756e1483d8eda16655e802d7c8 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: scanner.h,v 1.2 2000/06/19 15:48:23 kevin Exp $
+**  $Id: scanner.h,v 1.3 2000/06/19 17:58:20 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -54,6 +54,9 @@ class DetectorArray
   DetectorValue* m_detValues;  /* Pointer to array of values recorded by detector */
   int m_nDet;          /* Number of detectors in array */
   double m_viewAngle;    /* View angle in radians */
+
+  DetectorArray& operator=(const DetectorArray& rhs);
+  DetectorArray& operator()(const DetectorArray& rhs);
 };
 
 typedef enum {
@@ -71,6 +74,7 @@ class Scanner
   
   void collectProjections (Projections& proj, const Phantom& phm, const int start_view, const int trace);
 
+  void setNView (int nView);
   const unsigned int nDet(void) const {return m_nDet;}
   const unsigned int nView(void) const {return m_nView;}
   const double phmLen(void) const {return m_phmLen;}
index 8d3689567550a02ea1a4e670135193410552951a..8010912f32046b54eac5617250c1999470ac1cb4 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: projections.cpp,v 1.1 2000/06/19 02:59:34 kevin Exp $
+**  $Id: projections.cpp,v 1.2 2000/06/19 17:58:20 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
  */
 
 Projections::Projections (const Scanner& scanner)
+  : m_projData(0)
 {
-  init (scanner.nView(), scanner.nDet());
-
-  m_phmLen = scanner.phmLen();
-  m_rotInc = scanner.rotInc();
-  m_detInc = scanner.detInc();
-  m_rotStart = 0;
-  m_detStart =  -scanner.radius() + (scanner.detInc() / 2);
-  m_phmLen = scanner.phmLen();
+  initFromScanner (scanner);
 }
 
 
 Projections::Projections (const int nView, const int nDet)
+  : m_projData(0)
 {
   init (nView, nDet);
 }
 
 Projections::Projections (void)
+  : m_projData(0)
 {
   init (0, 0);
 }
@@ -72,11 +68,29 @@ Projections::init (const int nView, const int nDet)
 {
   m_nView = nView;
   m_nDet = nDet;
-  m_projData = NULL;
   newProjData ();
-  m_fd = -1;
 }
 
+void
+Projections::initFromScanner (const Scanner& scanner)
+{
+  deleteProjData();
+  init (scanner.nView(), scanner.nDet());
+
+  m_phmLen = scanner.phmLen();
+  m_rotInc = scanner.rotInc();
+  m_detInc = scanner.detInc();
+  m_rotStart = 0;
+  m_detStart =  -scanner.radius() + (scanner.detInc() / 2);
+  m_phmLen = scanner.phmLen();
+}
+
+void
+Projections::setNView (int nView)  // used by MPI to reduce # of views
+{
+  deleteProjData();
+  init (nView, m_nDet);
+}
 
 // NAME
 // newProjData
index dc3851cbbffb8507884ca8129ed7508d962ae683..b5981b1c16fd7f5928706370516c7a5701dab844 100644 (file)
@@ -2,7 +2,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: syserror.cpp,v 1.1 2000/06/19 02:58:08 kevin Exp $
+**  $Id: syserror.cpp,v 1.2 2000/06/19 17:58:20 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
@@ -19,6 +19,8 @@
 ******************************************************************************/
 
 #include <iostream>
+#include <exception>
+#include <stdexcept>
 #include <stdarg.h>
 #include <ctype.h>
 #include "kstddef.h"
@@ -87,12 +89,12 @@ void sys_verror (int severity, const char *msg, va_list arg)
     sys_error (ERR_FATAL, "illegal error code #%d  [sys_error]", severity);
   }
   
-  vfprintf (stdout, msg, arg);
-
-  cout << "\n";
+  char errStr[512];
+  vsnprintf (errStr, sizeof(errStr), msg, arg);
+  cout << errStr << endl;
   
   if (severity == ERR_FATAL)
-    exit(1);
+    throw runtime_error (errStr);
   
 #if INTERACTIVE_ERROR_DISPLAY
   cout << "A - Abort  C - Continue  W - Turn off warnings? ";
index c6d233978d797544bdbfeab2ae01c20848d5683e..42c90f2df277be70257fb77508f82d8cd466785d 100644 (file)
@@ -37,7 +37,7 @@ if USE_LAM
 CC_LAM = $(lamdir)/bin/balky
 LAM_EXTRA_SRC = mpiworld.cpp
 
-ctrec-lam: ctrec.cpp mpiworld.cpp ../include/ct.h 
+ctrec-lam: ctrec.cpp mpiworld.cpp ../include/ct.h  ../libctsim/libctsim.a ../libctsupport/libctsupport.a
        $(CC_LAM) @DEFS@ $(CFLAGS) $(INCLUDES) -DHAVE_MPI ctrec.cpp -o ctrec-lam $(LDFLAGS) $(LAM_EXTRA_SRC) @ctlibs@
 
 phm2pj-lam: phm2pj.cpp mpiworld.cpp ../include/ct.h