From 4076fbc077adfd9ee610beef09b52d9e12c14abb Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Tue, 2 Jan 2001 07:47:36 +0000 Subject: [PATCH] r333: *** empty log message *** --- include/array2dfile.h | 4 +++- include/ctsupport.h | 8 +++++++- include/phantom.h | 5 ++++- include/plotfile.h | 3 ++- libctsim/array2dfile.cpp | 27 ++++++++++++++++++++++++++- libctsim/phantom.cpp | 35 ++++++++++++++++++++++++++++++++++- libctsupport/plotfile.cpp | 16 ++++++++++++++-- 7 files changed, 90 insertions(+), 8 deletions(-) diff --git a/include/array2dfile.h b/include/array2dfile.h index 5aa522d..79ae2f2 100644 --- a/include/array2dfile.h +++ b/include/array2dfile.h @@ -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; + void printBrief (std::ostringstream& os) const; Array2dFileLabel (const Array2dFileLabel& rhs); @@ -204,6 +205,7 @@ public: void printLabels (std::ostream& os) const; void printLabelsBrief (std::ostream& os) const; + void printLabelsBrief (std::ostringstream& os) const; unsigned int nLabels() const { return m_labels.size(); } diff --git a/include/ctsupport.h b/include/ctsupport.h index 84eef25..b4063e3 100644 --- a/include/ctsupport.h +++ b/include/ctsupport.h @@ -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 @@ -48,6 +48,12 @@ #include #include +#if defined(MSVC) || HAVE_SSTREAM +#include +#else +#include +#endif + #define TRUE 1 #define FALSE 0 #define OK TRUE diff --git a/include/phantom.h b/include/phantom.h index 7d9b433..f8187c2 100644 --- a/include/phantom.h +++ b/include/phantom.h @@ -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;} 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; void printDefinitions (std::ostream& os) const; + void printDefinitions (std::ostringstream& os) const; 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));} diff --git a/include/plotfile.h b/include/plotfile.h index da40ed3..b88793f 100644 --- a/include/plotfile.h +++ b/include/plotfile.h @@ -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; }; diff --git a/libctsim/array2dfile.cpp b/libctsim/array2dfile.cpp index e0ab0a4..49f90f4 100644 --- a/libctsim/array2dfile.cpp +++ b/libctsim/array2dfile.cpp @@ -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; } } + +void +Array2dFileLabel::printBrief (std::ostringstream& os) const +{ + if (m_labelType == L_HISTORY) { + os << "History ("; + if (m_calcTime > 0) + os << m_calcTime << " secs, "; + os << getDateString().c_str() << "): " << m_strLabel.c_str() << "\n"; + } else if (m_labelType == L_USER) { + os << "Note (" << getDateString() << "): " << m_strLabel << "\n"; + } else { + os << "Unknown (" << getDateString() << "): " << m_strLabel << "\n"; + } +} /////////////////////////////////////////////////////////////////////////// @@ -696,6 +711,16 @@ Array2dFile::printLabelsBrief (std::ostream& os) const } } +void +Array2dFile::printLabelsBrief (std::ostringstream& os) const +{ + for (constLabelIterator l = m_labels.begin(); l != m_labels.end(); l++) { + const Array2dFileLabel& label = **l; + + label.printBrief (os); + } +} + const Array2dFileLabel& Array2dFile::labelGet (int i) const diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index d8fa862..b74e531 100644 --- a/libctsim/phantom.cpp +++ b/libctsim/phantom.cpp @@ -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++) { + const PhantomElement& rPE = **i; + os << "PhantomElement: nPoints=" << rPE.nOutlinePoints(); + os << ", atten=" << rPE.atten() << " rot=" << convertRadiansToDegrees (rPE.rot()) << "\n"; + os << "xmin=" << rPE.xmin() << ", ymin=" << rPE.ymin() << ", xmax=" << rPE.xmax() << ", ymax=" << rPE.ymax() << "\n"; + + if (false) + for (int i = 0; i < rPE.nOutlinePoints(); i++) + os << rPE.xOutline()[i] << "," << rPE.yOutline()[i] << "\n"; + } +} void Phantom::printDefinitions (std::ostream& os) const @@ -309,6 +326,15 @@ Phantom::printDefinitions (std::ostream& os) const } } +void +Phantom::printDefinitions (std::ostringstream& os) const +{ + for (PElemConstIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) { + const PhantomElement& rPE = **i; + rPE.printDefinition (os); + } +} + /* 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"; } +void +PhantomElement::printDefinition (std::ostringstream& os) const +{ + os << convertTypeToName (m_type) << " " << m_cx << " " << m_cy << " " << m_u << " " + << m_v << " " << convertRadiansToDegrees (m_rot) << " " << m_atten << "\n"; +} + PhmElemType PhantomElement::convertNameToType (const char* const typeName) { diff --git a/libctsupport/plotfile.cpp b/libctsupport/plotfile.cpp index ef8d264..be54e56 100644 --- a/libctsupport/plotfile.cpp +++ b/libctsupport/plotfile.cpp @@ -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"; - int i; + unsigned int i; for (i = 0; i < m_vecStrEzsetCommands.size(); i++) fs << m_vecStrEzsetCommands[i] << "\n"; @@ -347,3 +347,15 @@ PlotFile::printHeaders (std::ostream& os) const for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++) os << m_vecStrDescriptions[iDesc] << "\n"; } + +void +PlotFile::printHeaders (std::ostringstream& os) const +{ + os << "EZSet Commands\n"; + for (unsigned int iEZ = 0; iEZ < m_vecStrEzsetCommands.size(); iEZ++) + os << m_vecStrEzsetCommands[iEZ] << "\n"; + + os << "Descriptions\n"; + for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++) + os << m_vecStrDescriptions[iDesc] << "\n"; +} -- 2.34.1