r379: no message
[ctsim.git] / libctsim / projections.cpp
index 846daf3f03ea8f9ef45f67acbe8bd2954f7376d0..e9a57282c6224f5716578b97a43a7e25cdd92cfd 100644 (file)
@@ -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.41 2001/01/07 23:18:13 kevin Exp $
+**  $Id: projections.cpp,v 1.42 2001/01/10 21:21:53 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
@@ -404,10 +404,16 @@ Projections::copyViewData (const std::string& filename, std::ostream& os, int st
 bool 
 Projections::copyViewData (const char* const filename, std::ostream& os, int startView, int endView)
 {
 bool 
 Projections::copyViewData (const char* const filename, std::ostream& os, int startView, int endView)
 {
-  frnetorderstream is (filename, ios::in | ios::binary);
+  frnetorderstream is (filename, std::ios::in | std::ios::binary);
   kuint16 sizeHeader, signature;
   kuint32 _nView, _nDet;
   
   kuint16 sizeHeader, signature;
   kuint32 _nView, _nDet;
   
+  is.seekg (0);
+  if (is.fail()) {
+    sys_error (ERR_SEVERE, "Unable to read projection file %s", filename);
+    return false;
+  }
+
   is.readInt16 (sizeHeader);
   is.readInt16 (signature);
   is.readInt32 (_nView);
   is.readInt16 (sizeHeader);
   is.readInt16 (signature);
   is.readInt32 (_nView);
@@ -416,7 +422,7 @@ Projections::copyViewData (const char* const filename, std::ostream& os, int sta
   int nDet = _nDet;
   
   if (signature != m_signature) {
   int nDet = _nDet;
   
   if (signature != m_signature) {
-    sys_error (ERR_FATAL, "Illegal signature in projection file %s", filename);
+    sys_error (ERR_SEVERE, "Illegal signature in projection file %s", filename);
     return false;
   }
   
     return false;
   }
   
@@ -446,9 +452,9 @@ Projections::copyViewData (const char* const filename, std::ostream& os, int sta
   
   delete pViewData;
   if (is.fail()) 
   
   delete pViewData;
   if (is.fail()) 
-    sys_error (ERR_FATAL, "Error reading projection file");
+    sys_error (ERR_SEVERE, "Error reading projection file");
   if (os.fail()) 
   if (os.fail()) 
-    sys_error (ERR_FATAL, "Error writing projection file");
+    sys_error (ERR_SEVERE, "Error writing projection file");
   
   return (! (is.fail() | os.fail()));
 }
   
   return (! (is.fail() | os.fail()));
 }