r333: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 2 Jan 2001 07:47:36 +0000 (07:47 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 2 Jan 2001 07:47:36 +0000 (07:47 +0000)
include/array2dfile.h
include/ctsupport.h
include/phantom.h
include/plotfile.h
libctsim/array2dfile.cpp
libctsim/phantom.cpp
libctsupport/plotfile.cpp

index 5aa522db89080e67d93ba93850d465c74adfd15b..79ae2f26f74b1ea476f82ea4bb3ab4cddfd50b1d 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: array2dfile.h,v 1.16 2001/01/02 06:29:23 kevin Exp $
+**  $Id: array2dfile.h,v 1.17 2001/01/02 07:47:36 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
@@ -90,6 +90,7 @@ public:
 
     void print (std::ostream& os) const;
     void printBrief (std::ostream& os) const;\r
+    void printBrief (std::ostringstream& os) const;\r
 
     Array2dFileLabel (const Array2dFileLabel& rhs);
 
@@ -204,6 +205,7 @@ public:
 
   void printLabels (std::ostream& os) const;\r
   void printLabelsBrief (std::ostream& os) const;\r
+  void printLabelsBrief (std::ostringstream& os) const;\r
 \r
   unsigned int nLabels() const\r
   { return m_labels.size(); }\r
index 84eef25d596938d97f3a9fd29665468280966ec8..b4063e30a56eccb2f26f47b2c38d318e5059ff28 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctsupport.h,v 1.20 2001/01/01 10:14:34 kevin Exp $
+**  $Id: ctsupport.h,v 1.21 2001/01/02 07:47:36 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
 #include <vector>\r
 #include <algorithm>\r
 
+#if defined(MSVC) || HAVE_SSTREAM\r
+#include <sstream>
+#else\r
+#include <sstream_subst>
+#endif\r
+
 #define TRUE   1
 #define FALSE  0
 #define OK     TRUE
index 7d9b43392837c47e7b3cdd22a803095eaa346b78..f8187c2f3d0d303cb40ac24625ad7ef875932682 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phantom.h,v 1.18 2001/01/02 05:33:37 kevin Exp $
+**  $Id: phantom.h,v 1.19 2001/01/02 07:47:36 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
@@ -81,6 +81,7 @@ class PhantomElement
     const double v() const {return m_v;}\r
 \r
     void printDefinition (std::ostream& os) const;
+    void printDefinition (std::ostringstream& os) const;
 
  private:
     PhmElemType m_type;             // pelem type (box, ellipse, etc)
@@ -170,6 +171,7 @@ class Phantom
     void convertToImagefile (ImageFile& im, const int in_nsample, const int trace) const;
 \r
     void printDefinitions (std::ostream& os) const;\r
+    void printDefinitions (std::ostringstream& os) const;\r
 
     bool fail() const             {return m_fail;}
     const std::string& failMessage() const {return m_failMessage;}
@@ -188,6 +190,7 @@ class Phantom
     void addStdSheppLoganBordered ();
 
     void print (std::ostream& os) const;
+    void print (std::ostringstream& os) const;
 
     const double maxAxisLength () const {return (((m_xmax - m_xmin) > (m_ymax - m_ymin)) ? (m_xmax - m_xmin) : (m_ymax - m_ymin));}
 
index da40ed358f6cef38d9fd2ebb9dd93856da22ded5..b88793f43ff99d6f8713cf730b7e296ef93efc1e 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: plotfile.h,v 1.4 2000/12/23 18:12:35 kevin Exp $
+**  $Id: plotfile.h,v 1.5 2001/01/02 07:47:36 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,7 @@ public:
       {  return m_strFilename; }
 
   void printHeaders (std::ostream& os) const;
+  void printHeaders (std::ostringstream& os) const;
 };
 
 
index e0ab0a4e55d60bec0a5f3e4147ad27e2a0196798..49f90f45182c30c656ee2bdb17162cce4e01a059 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: array2dfile.cpp,v 1.25 2001/01/02 06:29:23 kevin Exp $
+**  $Id: array2dfile.cpp,v 1.26 2001/01/02 07:47:36 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
@@ -168,6 +168,21 @@ Array2dFileLabel::printBrief (std::ostream& os) const
     os << "Unknown (" << getDateString() << "): " << m_strLabel << std::endl;\r
   }\r
 }\r
+
+void\r
+Array2dFileLabel::printBrief (std::ostringstream& os) const\r
+{\r
+  if (m_labelType == L_HISTORY) {\r
+    os << "History (";\r
+    if (m_calcTime > 0)\r
+      os << m_calcTime << " secs, ";\r
+    os << getDateString().c_str() << "): " << m_strLabel.c_str() << "\n";
+  } else if (m_labelType == L_USER) {\r
+    os << "Note (" <<  getDateString() << "): " << m_strLabel << "\n";
+  } else {\r
+    os << "Unknown (" << getDateString() << "): " << m_strLabel << "\n";
+  }\r
+}\r
 \r
 
 ///////////////////////////////////////////////////////////////////////////
@@ -696,6 +711,16 @@ Array2dFile::printLabelsBrief (std::ostream& os) const
   }\r
 }\r
 \r
+void
+Array2dFile::printLabelsBrief (std::ostringstream& os) const\r
+{\r
+  for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) {\r
+    const Array2dFileLabel& label = **l;\r
+    \r
+    label.printBrief (os);\r
+  }\r
+}\r
+\r
 
 const Array2dFileLabel&
 Array2dFile::labelGet (int i) const
index d8fa862f625724968e328fc86be4eabdb03deaea..b74e531930a067cbc295b0b36a7075e29b77d9f8 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phantom.cpp,v 1.24 2001/01/02 05:33:37 kevin Exp $
+**  $Id: phantom.cpp,v 1.25 2001/01/02 07:47:36 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
@@ -299,6 +299,23 @@ Phantom::print (std::ostream& os) const
           os << rPE.xOutline()[i] << "," << rPE.yOutline()[i] << "\n";
   }
 }
+void 
+Phantom::print (std::ostringstream& os) const
+{
+  os << "Number of PElements: " << m_nPElem << "\n";
+  os << "Limits: xmin=" << m_xmin << ", ymin=" << m_ymin << ", xmax=" << m_xmax << ", ymax=" << m_ymax << "\n";
+  
+  for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) {\r
+    const PhantomElement& rPE = **i;
+      os << "PhantomElement: nPoints=" << rPE.nOutlinePoints();\r
+      os << ", atten=" << rPE.atten() << " rot=" << convertRadiansToDegrees (rPE.rot()) << "\n";
+      os << "xmin=" << rPE.xmin() << ", ymin=" << rPE.ymin() << ", xmax=" << rPE.xmax() << ", ymax=" << rPE.ymax() << "\n";
+    \r
+      if (false)
+        for (int i = 0; i < rPE.nOutlinePoints(); i++)
+          os << rPE.xOutline()[i] << "," << rPE.yOutline()[i] << "\n";
+  }
+}
 \r
 void\r
 Phantom::printDefinitions (std::ostream& os) const\r
@@ -309,6 +326,15 @@ Phantom::printDefinitions (std::ostream& os) const
   }\r
 }
 \r
+void\r
+Phantom::printDefinitions (std::ostringstream& os) const\r
+{\r
+  for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) {\r
+    const PhantomElement& rPE = **i;\r
+    rPE.printDefinition (os);\r
+  }\r
+}
+\r
 
 /* NAME
  *   show              Show vector outline of Phantom to user
@@ -583,6 +609,13 @@ PhantomElement::printDefinition (std::ostream& os) const
     << m_v << " " << convertRadiansToDegrees (m_rot) << " " << m_atten << "\n";\r
 }\r
 
+void\r
+PhantomElement::printDefinition (std::ostringstream& os) const\r
+{\r
+  os << convertTypeToName (m_type) << " " << m_cx << " " << m_cy << " " << m_u << " "\r
+    << m_v << " " << convertRadiansToDegrees (m_rot) << " " << m_atten << "\n";\r
+}\r
+
 PhmElemType
 PhantomElement::convertNameToType (const char* const typeName)
 {
index ef8d26420a5dfb95aec58445d17eac3d4667c4ea..be54e569e6dcb95d3f5f9f47ca954b9d91f5c423 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: plotfile.cpp,v 1.8 2001/01/02 05:34:57 kevin Exp $
+**  $Id: plotfile.cpp,v 1.9 2001/01/02 07:47:36 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
@@ -265,7 +265,7 @@ PlotFile::headerWrite (std::iostream& fs)
   fs.seekp (0);
   fs << m_iNumColumns << " " << m_iNumRecords << "\n";\r
 \r
-  int i;
+  unsigned int i;
   for (i = 0; i < m_vecStrEzsetCommands.size(); i++)\r
       fs << m_vecStrEzsetCommands[i] << "\n";\r
   \r
@@ -347,3 +347,15 @@ PlotFile::printHeaders (std::ostream& os) const
   for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++)\r
     os << m_vecStrDescriptions[iDesc] << "\n";
 }
+
+void
+PlotFile::printHeaders (std::ostringstream& os) const
+{\r
+  os << "EZSet Commands\n";\r
+  for (unsigned int iEZ = 0; iEZ < m_vecStrEzsetCommands.size(); iEZ++)\r
+    os << m_vecStrEzsetCommands[iEZ] << "\n";\r
+\r
+  os << "Descriptions\n";\r
+  for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++)\r
+    os << m_vecStrDescriptions[iDesc] << "\n";
+}