Commit 74a0b208 authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

Correction erreurs dans la nouvelle fonction ScanFits ajoutee pour piapp, Reza

parent c8c6644b
......@@ -266,18 +266,20 @@ int FitsManager::ScanFile(string filename, ostream& os, bool fgph, bool fgrd)
\param filename : FITS file name to be scanned
\param hdudesc : a textual description of each HDU
return value : vector of HDU-types (IMAGE_HDU, BINARY_TBL, ASCII_TBL)
return value : vector of HDU-types (0:Unknown/Probleme; 1:IMAGE_HDU, 2:BINARY_TBL, 3:ASCII_TBL)
*/
std::vector<int> FitsManager::ScanFile(std::string filename, std::vector<std::string>& hdudesc)
{
FitsInOutFile is(filename, FitsInOutFile::Fits_RO);
hdudesc.clear();
std::vector<int> rtyp;
std::vector<int> vrtyp;
int rtyp=0;
for(int k=0; k<is.NbHDUs(); k++) {
rtyp=0;
int hdutyp = is.CurrentHDUType();
std::stringstream os;
if (hdutyp == IMAGE_HDU) {
rtyp=1;
LONGLONG naxes[5] = {0,0,0,0,0};
int naxis=5;
int imgtyp = is.GetImageHDUInfo(naxis, naxes);
......@@ -292,8 +294,12 @@ std::vector<int> FitsManager::ScanFile(std::string filename, std::vector<std::st
vector<int> coltypes;
vector<LONGLONG> repcnt, width;
int ncols = is.GetColInfo(colnames, coltypes, repcnt, width);
if (hdutyp == BINARY_TBL) os << ">> BINARY_TBL : NRows= " << is.GetNbRows();
else os << ">> ASCII_TBL : NRows= " << is.GetNbRows();
if (hdutyp == BINARY_TBL) {
os << ">> BINARY_TBL : NRows= " << is.GetNbRows(); rtyp=2;
}
else {
os << ">> ASCII_TBL : NRows= " << is.GetNbRows(); rtyp=3;
}
os << " x NCols= " << ncols << endl;
for(size_t kk=0; kk<colnames.size(); kk++) {
os << "Col[" << kk+1 << "] Name= " << colnames[kk]
......@@ -302,8 +308,9 @@ std::vector<int> FitsManager::ScanFile(std::string filename, std::vector<std::st
<< " W= " << width[kk] << endl;
}
}
rtyp.push_back(hdutyp);
hdudesc.push_back(os.str());
vrtyp.push_back(rtyp);
hdudesc.push_back(os.str());
is.MoveToNextHDU();
}
return rtyp;
return vrtyp;
}
......@@ -36,8 +36,8 @@ class FitsManager {
//! Scans the fits file and prints information about each HDU on \b cout
static inline int ScanFile(string filename, bool fgph=false, bool fgrd=false)
{ return ScanFile(filename, cout, fgph, fgrd); }
//! Scans the fits file and return the list of HDU types , and a textual description of each HDU
static inline std::vector<int> ScanFile(std::string filename, std::vector<std::string>& hdudesc);
//! Scans the fits file and return the list of HDU types (0,1,2,3), and a textual description of each HDU
static std::vector<int> ScanFile(std::string filename, std::vector<std::string>& hdudesc);
protected:
//! Finds the appropriate handler for the object \b o in the list of registered handlers.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment