projects
/
ctsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r329: *** empty log message ***
[ctsim.git]
/
libctsim
/
projections.cpp
diff --git
a/libctsim/projections.cpp
b/libctsim/projections.cpp
index 42cc23ccfadd7a308e47c990b42774a891232bd6..4c31b3808748681a62e7ae33ad1c25a69ad17307 100644
(file)
--- 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
**
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: projections.cpp,v 1.3
1 2000/12/16 02:54:47
kevin Exp $
+** $Id: projections.cpp,v 1.3
4 2001/01/02 06:29:23
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
**
** 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
@@
-71,6
+71,15
@@
Projections::init (const int nView, const int nDet)
m_nView = nView;
m_nDet = nDet;
newProjData ();
m_nView = nView;
m_nDet = nDet;
newProjData ();
+
\r
+ time_t t = time (NULL);
\r
+ tm* lt = localtime (&t);
\r
+ m_year = lt->tm_year;
\r
+ m_month = lt->tm_mon;
\r
+ m_day = lt->tm_mday;
\r
+ m_hour = lt->tm_hour;
\r
+ m_minute = lt->tm_min;
\r
+ m_second = lt->tm_sec;
\r
}
void
}
void
@@
-91,7
+100,7
@@
Projections::initFromScanner (const Scanner& scanner)
#if 0
if (m_geometry == Scanner::GEOMETRY_EQUILINEAR) {
m_detInc /= 2;
#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
}
}
#endif
}
@@
-298,7
+307,7
@@
Projections::headerRead (fnetorderstream& fs)
}
bool
}
bool
-Projections::read (const string& filename)
+Projections::read (const st
d::st
ring& filename)
{
return read (filename.c_str());
}
{
return read (filename.c_str());
}
@@
-307,10
+316,14
@@
Projections::read (const string& filename)
bool
Projections::read (const char* filename)
{
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))
return false;
if (! headerRead (fileRead))
@@
-330,13
+343,13
@@
Projections::read (const char* filename)
bool
bool
-Projections::copyViewData (const st
ring& filename,
ostream& os, int startView, int endView)
+Projections::copyViewData (const st
d::string& filename, std::
ostream& os, int startView, int endView)
{
return copyViewData (filename.c_str(), os, startView, endView);
}
bool
{
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;
{
frnetorderstream is (filename, ios::in | ios::binary);
kuint16 sizeHeader, signature;
@@
-388,15
+401,15
@@
Projections::copyViewData (const char* const filename, ostream& os, int startVie
}
bool
}
bool
-Projections::copyHeader (const st
ring& filename,
ostream& os)
+Projections::copyHeader (const st
d::string& filename, std::
ostream& os)
{
return copyHeader (filename.c_str(), os);
}
bool
{
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);
kuint16 sizeHeader, signature;
is.readInt16 (sizeHeader);
is.readInt16 (signature);
@@
-423,7
+436,7
@@
Projections::copyHeader (const char* const filename, ostream& os)
}
bool
}
bool
-Projections::write (const string& filename)
+Projections::write (const st
d::st
ring& filename)
{
return write (filename.c_str());
}
{
return write (filename.c_str());
}
@@
-431,24
+444,13
@@
Projections::write (const string& filename)
bool
Projections::write (const char* filename)
{
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);
return false;
}
m_filename = filename;
if (! fs) {
sys_error (ERR_SEVERE, "Error opening file %s for output [projections_create]", filename);
return false;
}
-#ifdef HAVE_TIME
- time_t t = time(NULL);
- tm* lt = localtime(&t);
- m_year = lt->tm_year;
- m_month = lt->tm_mon;
- m_day = lt->tm_mday;
- m_hour = lt->tm_hour;
- m_minute = lt->tm_min;
- m_second = lt->tm_sec;
-#endif
-
if (! headerWrite (fs))
return false;
if (! headerWrite (fs))
return false;
@@
-591,7
+593,7
@@
Projections::printProjectionData (int startView, int endView)
}
void
}
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";
{
os << "Number of detectors: " << m_nDet << "\n";
os << " Number of views: " << m_nView<< "\n";