Index: trunk/SophyaExt/FitsIOServer/fiosinit.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fiosinit.cc	(revision 2897)
+++ trunk/SophyaExt/FitsIOServer/fiosinit.cc	(revision 2898)
@@ -32,5 +32,5 @@
 //   Enregistrement des classes FitsHandler
 //  FitsManager::RegisterHandler(new FitsArrayHandler<int_2> , "TArray<int_2>");
-  cout << " ---- FitsIOServerInitiator / DEBUG ---- debut RegisterHandler " << endl;
+  //DBG   cout << " ---- FitsIOServerInitiator / DEBUG ---- debut RegisterHandler " << endl;
   FitsManager::RegisterHandler(new FitsArrayHandler<int_4> , 1, "TArray<int_4> ");
   FitsManager::RegisterHandler(new FitsArrayHandler<r_4> , 1, "TArray<r_4>");
@@ -54,6 +54,6 @@
   FitsManager::RegisterHandler(new FITS_LocalMap<int_4> , 0, "LocalMap<int_4>");
 
-  cout << " ---- FitsIOServerInitiator / DEBUG ---- ListHandlers() : " << endl;
-  FitsManager::ListHandlers();
+  //DBG  cout << " ---- FitsIOServerInitiator / DEBUG ---- ListHandlers() : " << endl;
+  //DBG  FitsManager::ListHandlers();
 }
 
Index: trunk/SophyaExt/FitsIOServer/fitsarrhand.h
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsarrhand.h	(revision 2897)
+++ trunk/SophyaExt/FitsIOServer/fitsarrhand.h	(revision 2898)
@@ -52,6 +52,7 @@
     long naxes[BASEARRAY_MAXNDIMS];
     int naxis=BASEARRAY_MAXNDIMS;
-    if (FitsTypes::ImageType(x) == is.GetImageHDUInfo(naxis, naxes))
-      return 2;
+    int imgtyp = is.GetImageHDUInfo(naxis, naxes);
+    if (naxis < 1) return 0;
+    if (FitsTypes::ImageType(x) == imgtyp)  return 2;
     else return 1;
   }
Index: trunk/SophyaExt/FitsIOServer/fitsfile.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 2897)
+++ trunk/SophyaExt/FitsIOServer/fitsfile.cc	(revision 2898)
@@ -247,5 +247,5 @@
 {
   FitsInFile fis(is);
-  fis.ReadHeader(0);
+  fis.ReadHeader(fis.CurrentHDU());
   ReadFromFits(fis);
 }
Index: trunk/SophyaExt/FitsIOServer/fitslocalmap.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitslocalmap.cc	(revision 2897)
+++ trunk/SophyaExt/FitsIOServer/fitslocalmap.cc	(revision 2898)
@@ -93,5 +93,5 @@
   long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 
   if (ncols < 1) return 0;
-  T x;
+  T x = 0;
   if (coltypes[0] == FitsTypes::DataType(x)) return 2 ;
   else return 1;
Index: trunk/SophyaExt/FitsIOServer/fitsmanager.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsmanager.cc	(revision 2897)
+++ trunk/SophyaExt/FitsIOServer/fitsmanager.cc	(revision 2898)
@@ -75,4 +75,5 @@
   for(it = hlistp->begin(); it != hlistp->end(); it++) {
     hfg = (*it).fhi->CheckHandling(o);
+    if (hfg < 1) continue;
     if ( ( hfg > bhfg ) || ( (hfg == bhfg) && ((*it).glev > blev) ) ) {
       fhi = (*it).fhi;  bhfg = hfg;  blev = (*it).glev;
@@ -114,4 +115,5 @@
   for(it = hlistp->begin(); it != hlistp->end(); it++) {
     hfg = (*it).fhi->CheckReadability(is);
+    if (hfg < 1) continue;
     if ( ( hfg > bhfg ) || ( (hfg == bhfg) && ((*it).glev > blev) ) ) {
       fhi = (*it).fhi;  bhfg = hfg;  blev = (*it).glev;
@@ -136,2 +138,86 @@
   return fhi2;
 }
+
+/*!
+  \param filename : FITS file name to be scanned
+  \param os : infomation will be sent to formatted stream os
+  \param slev : scan level , bit 0 (1/3) print HDU keywords,
+  bit 2 (2,3) try to read HDU data using the appropraite handler
+  \param Rc : return number of scanned HDU's
+ */
+int FitsManager::ScanFile(string filename, ostream& os, int slev)
+{
+  FitsInOutFile is(filename, FitsInOutFile::Fits_RO);
+  os << "=== FitsManager::ScanFile( " << filename << " ) NbHDUs= " 
+     << is.NbHDUs() << endl;
+  int rc = 0;
+  for(int k=0; k<is.NbHDUs(); k++) {
+    os << " ------ HDU No " << is.CurrentHDU() << " Type= " 
+	 << is.CurrentHDUTypeStr() << endl;
+    int hdutyp = is.CurrentHDUType();
+    if (hdutyp == IMAGE_HDU) {
+      long naxes[5] = {0,0,0,0,0};
+      int naxis=5;
+      int imgtyp = is.GetImageHDUInfo(naxis, naxes);
+      os << ">> IMAGE_HDU:  naxis= " << naxis << " : ";
+      for(int i=0; i<naxis; i++) {
+	if (i>0) os << " x " ;
+	os << naxes[i];
+      }
+      os << endl;
+    }
+    else {
+      vector<string> colnames;
+      vector<int> coltypes;
+      vector<long> repcnt;
+      vector<long> 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();
+      os << " x NCols= " << ncols << endl;
+      for(int kk=0; kk<colnames.size(); kk++) {
+	os << "Col[" << kk+1 << "]  Name= " << colnames[kk] 
+	     << " Type= " << FitsTypes::DataTypeToTypeString(coltypes[kk])
+	     << " Repeat= " << repcnt[kk]
+	     << " W= " << width[kk] << endl;
+      }
+    }
+    // Fin the appropriate handler :
+    ChkHLP(); 
+    FitsHandlerInterface * fhi = NULL;
+    HandlerList::iterator it;
+    string hdesc;
+    int hfg = 0;
+    int bhfg = 0;
+    int blev = 0;
+    for(it = hlistp->begin(); it != hlistp->end(); it++) {
+      hfg = (*it).fhi->CheckReadability(is);
+      if (hfg < 1) continue;
+      if ( ( hfg > bhfg ) || ( (hfg == bhfg) && ((*it).glev > blev) ) ) {
+	fhi = (*it).fhi;  bhfg = hfg;  blev = (*it).glev; hdesc = (*it).desc; 
+      }
+    }
+    if (fhi == NULL) 
+      os << ">>> Warning : No handler found for this HDU ... " << endl;
+    else 
+      os << ">>> Reader/handler: " <<  hdesc << " : " 
+	 << typeid(*fhi).name() << " HandLevel= " << blev << ", "  << bhfg << endl;
+    if (fhi && (slev >= 2)) {
+      os << ">>> Trying to read HDU data using the handler ..." << endl;
+      FitsHandlerInterface* fhic = fhi->Clone();
+      fhic->Read(is);
+      os << " FitsHandler.Read() OK " << endl;
+    }
+    if ( (slev == 1) || (slev == 3) ) {
+      os << ">>>> HDU keywords list :  " <<  endl;
+      DVList dvl;
+      is.GetHeaderRecords(dvl);
+      os << dvl;
+    }
+    os << "               --------------------- " << endl;
+    is.MoveToNextHDU();
+    rc++;
+  }
+  os << "===================================================" << endl; 
+  return rc;
+}
Index: trunk/SophyaExt/FitsIOServer/fitsmanager.h
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsmanager.h	(revision 2897)
+++ trunk/SophyaExt/FitsIOServer/fitsmanager.h	(revision 2898)
@@ -4,4 +4,5 @@
 #include "machdefs.h"
 #include <string>
+#include <iostream>
 #include "fitsinoutfile.h"
 
@@ -26,4 +27,10 @@
   //! Finds the appropriate reader for the current HDU and reads the data form \b is
   static FitsHandlerInterface * Read(FitsInOutFile& is);
+  //! Scans the fits file and prints information about each HDU on formatted stream \b os
+  static int ScanFile(string filename, ostream& os, int slev=0);
+  //! Scans the fits file and prints information about each HDU on \b cout
+  static inline int ScanFile(string filename, int slev=0)
+    { return ScanFile(filename, cout, slev); }
+
  protected:
   //! Finds the appropriate handler for the object \b o in the list of registered handlers.
Index: trunk/SophyaExt/FitsIOServer/fitsntuple.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsntuple.cc	(revision 2897)
+++ trunk/SophyaExt/FitsIOServer/fitsntuple.cc	(revision 2898)
@@ -61,4 +61,6 @@
   string clsnm = is.KeyValue(key);
   if (clsnm == "SOPHYA::NTuple")  return 2;
+  key = "Content";
+  if (is.KeyValue(key) == "NTuple") return 2;
   else return 1;
 }
Index: trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc	(revision 2897)
+++ trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc	(revision 2898)
@@ -102,5 +102,5 @@
   long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 
   if (ncols < 1) return 0;
-  T x;
+  T x = 0;
   if (coltypes[0] == FitsTypes::DataType(x)) return 2 ;
   else return 1;
Index: trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.cc
===================================================================
--- trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.cc	(revision 2897)
+++ trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.cc	(revision 2898)
@@ -94,5 +94,5 @@
   long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 
   if (ncols < 1) return 0;
-  T x;
+  T x = 0;
   if (coltypes[0] == FitsTypes::DataType(x)) return 2 ;
   else return 1;
