Index: trunk/SophyaExt/FitsIOServer/fabtcolread.h
===================================================================
--- trunk/SophyaExt/FitsIOServer/fabtcolread.h	(revision 2791)
+++ trunk/SophyaExt/FitsIOServer/fabtcolread.h	(revision 3114)
@@ -104,5 +104,5 @@
   inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
   //! Get the FITS file pointer (cfistio pointer)
-  inline fitsfile* GetFitsPtr(void) const {return FitsPtr;}
+  inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
   //! Get the number of HDU in the FITS file
   inline int NHDU(void) const
@@ -156,5 +156,4 @@
   unsigned long NFitsRead;
   FitsOpenFile* FitsOF;
-  fitsfile* FitsPtr; // Redite avec FitsOF->FitsPtr, mais utilise partout!
   long LineDeb, LineFin;
   double *Buffer;
@@ -193,9 +192,9 @@
   string ReadKeyS(char *keyname);
 
-  long Read(TMatrix<uint_2>& data);
-  long Read(TMatrix<int_4>& data);
-  long Read(TMatrix<int_8>& data);
-  long Read(TMatrix<float>& data);
-  long Read(TMatrix<double>& data);
+  size_t Read(TMatrix<uint_2>& data);
+  size_t Read(TMatrix<int_4>& data);
+  size_t Read(TMatrix<int_8>& data);
+  size_t Read(TMatrix<float>& data);
+  size_t Read(TMatrix<double>& data);
 
   //! Set debug level
@@ -206,5 +205,5 @@
   inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
   //! Get the FITS file pointer (cfistio pointer)
-  inline fitsfile* GetFitsPtr(void) const {return FitsPtr;}
+  inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
   //! Get the number of HDU in the FITS file
   inline int NHDU(void) const
@@ -229,5 +228,4 @@
 
   FitsOpenFile* FitsOF;
-  fitsfile* FitsPtr; // Redite avec FitsOF->FitsPtr, mais utilise partout!
 };
 
@@ -243,4 +241,69 @@
 };
 
+
+///////////////////////////////////////////////////////////////////
+//! Class for reading a 3D image from a FITS file
+class FitsImg3DRd : public AnyDataObj {
+public:
+  FitsImg3DRd(FitsOpenFile* fof,int ihdu=0,int lp=0);
+  FitsImg3DRd(FitsImg3DRd& fbt);
+  FitsImg3DRd();
+  virtual ~FitsImg3DRd();
+
+  double ReadKey(char *keyname);
+  long   ReadKeyL(char *keyname);
+  string ReadKeyS(char *keyname);
+
+  size_t Read(TArray<uint_2>& data);
+  size_t Read(TArray<int_4>& data);
+  size_t Read(TArray<int_8>& data);
+  size_t Read(TArray<float>& data);
+  size_t Read(TArray<double>& data);
+
+  //! Set debug level
+  inline void    SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
+  //! Set null value to be return when reading null data (0=return the data)
+  inline void    SetNulVal(double nulval=0.) {NulVal = nulval;}
+  //! Get the pointer to FitsOpenFile
+  inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
+  //! Get the FITS file pointer (cfistio pointer)
+  inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
+  //! Get the number of HDU in the FITS file
+  inline int NHDU(void) const
+         {if(FitsOF) return FitsOF->NHDU(); else return 0;}
+  //! Get the number of the HDU read
+  inline int HDU(void) const
+         {if(FitsOF) return FitsOF->HDU(); else return 0;}
+  //! Get the HDU type
+  inline int HDUType(void) const
+         {if(FitsOF) return FitsOF->HDUType(); else return 0;}
+  //! Get NAXIS1
+  inline long Naxis1(void) const {return Naxis[0];}
+  //! Get NAXIS2
+  inline long Naxis2(void) const {return Naxis[1];}
+  //! Get NAXIS3
+  inline long Naxis3(void) const {return Naxis[2];}
+
+protected:
+  void Init(FitsOpenFile* fof,int ihdu,int lp);
+
+  long Naxis[3];
+  double NulVal;
+  unsigned short DbgLevel;
+
+  FitsOpenFile* FitsOF;
+};
+
+///////////////////////////////////////////////////////////////////
+//! Class for reading a 3D image from a FITS file
+class FitsImg3DRead : public FitsImg3DRd {
+public:
+  FitsImg3DRead(string fname,int ihdu=0,int lp=0);
+  FitsImg3DRead(const char *cfname,int ihdu=0,int lp=0);
+  FitsImg3DRead(FitsImg3DRead& fbt);
+  FitsImg3DRead();
+  virtual ~FitsImg3DRead();
+};
+
 } // namespace SOPHYA
 #endif    /* FABTCOLREAD_H_SEEN */
