** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: projections.cpp,v 1.30 2000/12/16 02:52:59 kevin Exp $
+** $Id: projections.cpp,v 1.33 2000/12/17 22:30:09 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
#if 0
if (m_geometry == Scanner::GEOMETRY_EQUILINEAR) {
m_detInc /= 2;
- cout << "Kludge: detInc /= 2 in Projections::initFromScanner" << endl;
+ std::cout << "Kludge: detInc /= 2 in Projections::initFromScanner" << endl;
}
#endif
}
}
bool
-Projections::read (const string& filename)
+Projections::read (const std::string& filename)
{
return read (filename.c_str());
}
bool
Projections::read (const char* filename)
{
- frnetorderstream fileRead (filename, ios::in | ios::binary);
- m_filename = filename;
-
- if (! fileRead)
+ m_filename = filename;\r
+#ifdef MSVC\r
+ frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary);\r
+#else\r
+ frnetorderstream fileRead (m_filename.c_str(), std::ios::in | std::ios::binary | std::ios::nocreate);\r
+#endif\r
+
+ if (fileRead.fail())
return false;
if (! headerRead (fileRead))
bool
-Projections::copyViewData (const string& filename, ostream& os, int startView, int endView)
+Projections::copyViewData (const std::string& filename, std::ostream& os, int startView, int endView)
{
return copyViewData (filename.c_str(), os, startView, endView);
}
bool
-Projections::copyViewData (const char* const filename, ostream& os, int startView, int endView)
+Projections::copyViewData (const char* const filename, std::ostream& os, int startView, int endView)
{
frnetorderstream is (filename, ios::in | ios::binary);
kuint16 sizeHeader, signature;
for (int i = startView; i <= endView; i++) {
is.seekg (sizeHeader + i * sizeView);
- is.read (reinterpret_cast<void*>(pViewData), sizeView);
- os.write (reinterpret_cast<void*>(pViewData), sizeView);
+ is.read (reinterpret_cast<char*>(pViewData), sizeView);
+ os.write (reinterpret_cast<char*>(pViewData), sizeView);
if (is.fail() || os.fail())
break;
}
}
bool
-Projections::copyHeader (const string& filename, ostream& os)
+Projections::copyHeader (const std::string& filename, std::ostream& os)
{
return copyHeader (filename.c_str(), os);
}
bool
-Projections::copyHeader (const char* const filename, ostream& os)
+Projections::copyHeader (const char* const filename, std::ostream& os)
{
- frnetorderstream is (filename, ios::in | ios::binary);
+ frnetorderstream is (filename, std::ios::in | std::ios::binary);
kuint16 sizeHeader, signature;
is.readInt16 (sizeHeader);
is.readInt16 (signature);
}
unsigned char* pHdrData = new unsigned char [sizeHeader];
- is.read (reinterpret_cast<void*>(pHdrData), sizeHeader);
+ is.read (reinterpret_cast<char*>(pHdrData), sizeHeader);
if (is.fail()) {
sys_error (ERR_FATAL, "Error reading header");
return false;
}
- os.write (reinterpret_cast<void*>(pHdrData), sizeHeader);
+ os.write (reinterpret_cast<char*>(pHdrData), sizeHeader);
if (os.fail()) {
sys_error (ERR_FATAL, "Error writing header");
return false;
}
bool
-Projections::write (const string& filename)
+Projections::write (const std::string& filename)
{
return write (filename.c_str());
}
bool
Projections::write (const char* filename)
{
- frnetorderstream fs (filename, ios::out | ios::binary | ios::trunc | ios::ate);
+ frnetorderstream fs (filename, std::ios::out | std::ios::binary | std::ios::trunc | std::ios::ate);
m_filename = filename;
if (! fs) {
sys_error (ERR_SEVERE, "Error opening file %s for output [projections_create]", filename);
}
void
-Projections::printScanInfo (ostringstream& os) const
+Projections::printScanInfo (std::ostringstream& os) const
{
os << "Number of detectors: " << m_nDet << "\n";
os << " Number of views: " << m_nView<< "\n";