From 5cf6874680f80d238bf34535d711dc223813f951 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Mon, 19 Jun 2000 17:58:20 +0000 Subject: [PATCH] r101: *** empty log message *** --- ChangeLog | 2 ++ include/ct.h | 4 +++- include/projections.h | 7 +++++-- include/scanner.h | 6 +++++- libctsim/projections.cpp | 36 +++++++++++++++++++++++++----------- libctsupport/syserror.cpp | 12 +++++++----- src/Makefile.am | 2 +- 7 files changed, 48 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0551cc8..f426b5b 100644 --- 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 diff --git a/include/ct.h b/include/ct.h index 2b59b41..c3ec83d 100644 --- a/include/ct.h +++ b/include/ct.h @@ -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 #include #include +#include +#include using namespace std; diff --git a/include/projections.h b/include/projections.h index bbf4305..c1302a9 100644 --- a/include/projections.h +++ b/include/projections.h @@ -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); }; diff --git a/include/scanner.h b/include/scanner.h index aebf7d1..005c802 100644 --- a/include/scanner.h +++ b/include/scanner.h @@ -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;} diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index 8d36895..8010912 100644 --- a/libctsim/projections.cpp +++ b/libctsim/projections.cpp @@ -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 @@ -39,24 +39,20 @@ */ 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 diff --git a/libctsupport/syserror.cpp b/libctsupport/syserror.cpp index dc3851c..b5981b1 100644 --- a/libctsupport/syserror.cpp +++ b/libctsupport/syserror.cpp @@ -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 +#include +#include #include #include #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? "; diff --git a/src/Makefile.am b/src/Makefile.am index c6d2339..42c90f2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 -- 2.34.1