** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: projections.cpp,v 1.39 2001/01/07 22:53:36 kevin Exp $
+** $Id: projections.cpp,v 1.43 2001/01/12 16:41:56 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
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);
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;
}
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()));
}
is.readInt16 (signature);
is.seekg (0);
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;
}
unsigned char* pHdrData = new unsigned char [sizeHeader];
is.read (reinterpret_cast<char*>(pHdrData), sizeHeader);
if (is.fail()) {
- sys_error (ERR_FATAL, "Error reading header");
+ sys_error (ERR_SEVERE, "Error reading header");
return false;
}
os.write (reinterpret_cast<char*>(pHdrData), sizeHeader);
if (os.fail()) {
- sys_error (ERR_FATAL, "Error writing header");
+ sys_error (ERR_SEVERE, "Error writing header");
return false;
}
if (! v || nx == 0 || ny == 0)
return false;
+#ifndef HAVE_FFT
+ return false;
+#else
Array2d<double> adView (nx, ny);
Array2d<double> adDet (nx, ny);
double** ppdView = adView.getArray();
delete [] ppcDetValue;
return true;
+#endif
}
v[ix][iy] = 0;
}
} else if (iInterpolationID == POLAR_INTERP_BILINEAR) {
- int iFloorView = ppdView[ix][iy];
+ int iFloorView = static_cast<int>(ppdView[ix][iy]);
double dFracView = ppdView[ix][iy] - iFloorView;
- int iFloorDet = ppdDet[ix][iy];
+ int iFloorDet = static_cast<int>(ppdDet[ix][iy]);
double dFracDet = ppdDet[ix][iy] - iFloorDet;
if (iFloorDet >= 0 && iFloorView >= 0) {