X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Fprojections.cpp;h=e9a57282c6224f5716578b97a43a7e25cdd92cfd;hp=846daf3f03ea8f9ef45f67acbe8bd2954f7376d0;hb=5ff5b33a6bc64fb804106c4d50b83e4cf0d7b0f4;hpb=c04ed309e5f8ad29d194b52c0f82f0be53ed56f3 diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index 846daf3..e9a5728 100644 --- 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 ** -** $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 @@ -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) { - frnetorderstream is (filename, ios::in | ios::binary); + frnetorderstream is (filename, std::ios::in | std::ios::binary); 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); @@ -416,7 +422,7 @@ Projections::copyViewData (const char* const filename, std::ostream& os, int sta 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; } @@ -446,9 +452,9 @@ Projections::copyViewData (const char* const filename, std::ostream& os, int sta delete pViewData; if (is.fail()) - sys_error (ERR_FATAL, "Error reading projection file"); + sys_error (ERR_SEVERE, "Error reading projection file"); if (os.fail()) - sys_error (ERR_FATAL, "Error writing projection file"); + sys_error (ERR_SEVERE, "Error writing projection file"); return (! (is.fail() | os.fail())); }