Index: /trunk/SophyaLib/NTools/cimage.cc
===================================================================
--- /trunk/SophyaLib/NTools/cimage.cc	(revision 1158)
+++ /trunk/SophyaLib/NTools/cimage.cc	(revision 1159)
@@ -47,4 +47,104 @@
 }
 
+
+// --------------------------------------------------------
+//   Les objets delegues pour la gestion de persistance 
+// --------------------------------------------------------
+/*!
+  \class SOPHYA::FIO_Image
+  \ingroup Image
+  Class for persistent management of Image
+
+ */
+///////////////////////////////////////////////////////////
+
+//! Default constructor
+template <class T>
+FIO_Image<T>::FIO_Image()
+  : FIO_TArray<T>()
+{
+}
+
+
+//! Constructor from the file \b filename
+template <class T>
+FIO_Image<T>::FIO_Image(string const & filename) 
+  : FIO_TArray<T>(filename) 
+{
+}
+
+//! Constructor from the Image \b obj
+template <class T>
+FIO_Image<T>::FIO_Image(const Image<T> & obj) 
+  : FIO_TArray<T>()
+{ 
+  dobj = new Image<T>(obj, true);
+  ownobj=true; 
+}
+
+//! Connect with a Image \b obj
+template <class T>
+FIO_Image<T>::FIO_Image(Image<T> * obj) 
+  : FIO_TArray<T>(obj)
+{ 
+}
+
+
+//! Connect Image \b o
+template <class T>
+void FIO_Image<T>::SetDataObj(AnyDataObj & o)
+{
+  Image<T> * po = dynamic_cast< Image<T> * >(&o);
+  if (po == NULL) return;
+  if (ownobj && dobj) delete dobj;
+  dobj = po; ownobj = false;
+} 
+
+template <class T>
+void FIO_Image<T>::ReadSelf(PInPersist& is)
+{
+  if (dobj == NULL) dobj = new Image<T>;
+  Image<T> * img = dynamic_cast<Image<T> * > (dobj);
+// On lit les 3 premiers uint_4
+//  0: Numero de version,  1 : reserve
+  uint_4 itab[3];
+  is.Get(itab,3);
+
+// Image<T> part data
+  r_8 orgx, orgy;
+  is.Get(orgx);
+  is.Get(orgy);
+  img->SetOrg(orgx, orgy);
+  r_8 szx, szy;
+  is.Get(szx);
+  is.Get(szy);
+  img->SetPixelSize(szx, szy);
+
+// Reading the TArray part 
+  FIO_TArray<T>::ReadSelf(is);
+}
+
+template <class T>
+void FIO_Image<T>::WriteSelf(POutPersist& os) const
+{
+  if (dobj == NULL)   return;
+  Image<T> * img = dynamic_cast<Image<T> * > (dobj);
+//  On ecrit 3 uint_4 .... 
+  uint_4 itab[3];
+  itab[0] = 1;  // Numero de version a 1
+  itab[1] = 0; 
+  itab[2] = 0; 
+  os.Put(itab,3);
+
+// Image<T> part data
+  os.Put(img->XOrg());
+  os.Put(img->XOrg());
+  os.Put(img->XPixSize());
+  os.Put(img->YPixSize());
+
+// Writing the TArray part 
+  FIO_TArray<T>::WriteSelf(os);
+}
+
 ///////////////////////////////////////////////////////////////
 #ifdef __CXX_PRAGMA_TEMPLATES__
@@ -56,4 +156,10 @@
 //#pragma define_template Image< complex<r_4> > 
 //#pragma define_template Image< complex<r_8> > 
+
+#pragma define_template FIO_Image<uint_2>
+#pragma define_template FIO_Image<int_4>
+#pragma define_template FIO_Image<int_8>
+#pragma define_template FIO_Image<r_4>
+#pragma define_template FIO_Image<r_8>
 #endif
 
@@ -66,3 +172,10 @@
 //template class Image< complex<r_4> >;
 //template class Image< complex<r_8> >;
+
+template class FIO_Image<uint_2>;
+template class FIO_Image<int_4>;
+template class FIO_Image<int_8>;
+template class FIO_Image<r_4>;
+template class FIO_Image<r_8>;
+
 #endif
Index: /trunk/SophyaLib/NTools/cimage.h
===================================================================
--- /trunk/SophyaLib/NTools/cimage.h	(revision 1158)
+++ /trunk/SophyaLib/NTools/cimage.h	(revision 1159)
@@ -8,4 +8,5 @@
 
 #include "tmatrix.h"
+#include "fioarr.h"
 
 
@@ -61,4 +62,34 @@
 }
 
+/////////////////////////////////////////////////////////////////////////
+//! Class for persistent management of Image
+template <class T>
+class FIO_Image : public FIO_TArray<T>   {
+public:
+  FIO_Image();
+  FIO_Image(string const & filename); 
+  FIO_Image(const Image<T> & obj);
+  FIO_Image(Image<T> * obj);
+  //  virtual ~FIO_Image();  
+  virtual void        SetDataObj(AnyDataObj & o);
+  inline operator Image<T>() { return(*(dynamic_cast<Image<T> * >dobj)); }
+protected :
+  virtual void ReadSelf(PInPersist&);           
+  virtual void WriteSelf(POutPersist&) const;  
+};
+
+/*! \ingroup Image \fn operator<<(POutPersist&,Image<T>&)
+  \brief Write Image \b obj into POutPersist stream \b os */
+template <class T>
+inline POutPersist& operator << (POutPersist& os, Image<T> & obj)
+{ FIO_Image<T> fio(&obj);  fio.Write(os);  return(os); }
+
+/*! \ingroup Image \fn operator>>(PInPersist&,Image<T>&)
+  \brief Read Image \b obj from PInPersist stream \b os */
+template <class T>
+inline PInPersist& operator >> (PInPersist& is, Image<T> & obj)
+{ FIO_Image<T> fio(&obj);  fio.Read(is);  return(is); }
+
+
 
 typedef Image<uint_2> ImageU2;
Index: /trunk/SophyaLib/NTools/ntoolsinit.cc
===================================================================
--- /trunk/SophyaLib/NTools/ntoolsinit.cc	(revision 1158)
+++ /trunk/SophyaLib/NTools/ntoolsinit.cc	(revision 1159)
@@ -30,18 +30,25 @@
   if (FgInit > 1)  return;
 
-//   Enregistrement des classes PPersist du modules Outils++
-  
-  //  PPRegister(OMatrix);
-  //  PPRegister(OVector);
+//   Enregistrement des classes PPersist du modules NTools
 
+  //  Objets Poly et Poly2  (pas encore a la norme Sophya::PPersist)
   PPRegister(ObjFileIO<Poly>);
   PPRegister(ObjFileIO<Poly2>);
 
+  // Classe GeneralFitData et son PPersist handler
   PPRegister(ObjFileIO<GeneralFitData>);
   DObjRegister(ObjFileIO<GeneralFitData>, GeneralFitData);
 
-  DObjRegister(FIO_TArray<uint_2>, Image<uint_2>);
-  DObjRegister(FIO_TArray<int_4>, Image<int_4>);
-  DObjRegister(FIO_TArray<r_4>, Image<r_4>);
+  // Classes Image<T> et leurs  PPersist handler
+  PPRegister(FIO_Image<uint_2>);
+  DObjRegister(FIO_Image<uint_2>, Image<uint_2>);
+  PPRegister(FIO_Image<int_4>);
+  DObjRegister(FIO_Image<int_4>, Image<int_4>);
+  PPRegister(FIO_Image<int_8>);
+  DObjRegister(FIO_Image<int_8>, Image<int_8>);
+  PPRegister(FIO_Image<r_4>);
+  DObjRegister(FIO_Image<r_4>, Image<r_4>);
+  PPRegister(FIO_Image<r_8>);
+  DObjRegister(FIO_Image<r_8>, Image<r_8>);
 
 
