]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOImageReader.h
move directory
[creaImageIO.git] / src2 / creaImageIOImageReader.h
index e36f2269fc33d34d1d4a9f88fe71f111a34ad2a1..ab9fbe70b3bb70b2d02f16ffe1ff4109525fb5af 100644 (file)
@@ -1,41 +1,31 @@
 #ifndef __creaImageIOImageReader_h_INCLUDED__
 #define __creaImageIOImageReader_h_INCLUDED__
 
-
-#include <creaImageIOTreeAttributeDescriptor.h>
-
-#include <vtkImageData.h>
-#include <string>
-#include <vector>
-#include <map>
+#include <creaImageIOSystem.h>
+#include <creaImageIOAbstractImageReader.h>
 
 namespace creaImageIO
 {
 
-
-  //=====================================================================
-  /// Image reader of a specific image format
-  class SpecificImageReader;
-  //=====================================================================
-
-  //=====================================================================
-  /// Generic image reader which stores a vector of SpecificImageReader
-  class ImageReader
+  /**
+   * \ingroup IO
+   * \brief Generic image reader which uses all the specific concrete image reader of the lib (tif, jpg, dicom, ...)
+   */
+  class CREAIMAGEIO_EXPORT ImageReader : virtual public AbstractImageReader
   {
   public:
     ImageReader();
     ~ImageReader();
 
-    /// Returns the known extensions
-    const std::vector<std::string>& GetKnownExtensions()  
-    { return mKnownExtensions; }
+    /// Pushes back all kwown extensions (without dot) in the vector given
+    void PushBackExtensions(std::vector<std::string>&);
+
     /// Returns true iff the file is readable
-    bool CanRead( const std::string& filename, 
-                 const std::string& exclude = "");
+    bool CanRead( const std::string& filename);
     /// Reads and returns the image data. 
     /// Returns an "Unreadable image" picture if fails
-    vtkImageData* ReadImage( const std::string& filename,
-                            const std::string& exclude = "");
+    vtkImageData* ReadImage( const std::string& filename);
     
     /// Reads the attributes of the image.
     /// Requested attributes names are provided as keys 
@@ -43,18 +33,28 @@ namespace creaImageIO
     /// On return, the values of the map are the values 
     /// of the attributes (empty string if not available).
     void ReadAttributes(const std::string& filename, 
-                       std::map<std::string,std::string>& attr);
+                       tree::AttributeMapType& attr);
+
+    /// Exclude specific readers 
+    /// TO DO...
+    
 
   protected:
     
-    void Register(SpecificImageReader*);
+    /// Register a reader
+    void Register( boost::shared_ptr<AbstractImageReader> );
 
-    std::vector<SpecificImageReader*> mReader;
-    std::vector<std::string> mKnownExtensions;
+       std::vector<boost::shared_ptr<AbstractImageReader> > mReader;
     vtkImageData* mUnreadableImage;
 
     std::string mLastFilename;
-    SpecificImageReader* mLastReader;
+       boost::shared_ptr<AbstractImageReader> mLastReader;
+
+       bool ShallNotRead( const std::string& filename );
+
+       void UnRegister(const std::string i_val);
+
+       std::vector <std::string> mUnReader;
     
   private: