]> Creatis software - creaImageIO.git/blobdiff - src/creaImageIOImageReader.h
new Output format and structure for Gimmick. Based on creaImageIO Output document...
[creaImageIO.git] / src / creaImageIOImageReader.h
index 2ac860f33e90b1d20ad03e7b3adc67677e244d86..1bf201c16de8c80e3d2375b1f91be9e6718f0c11 100644 (file)
@@ -1,51 +1,64 @@
 #ifndef __creaImageIOImageReader_h_INCLUDED__
 #define __creaImageIOImageReader_h_INCLUDED__
 
-
-#include <creaImageIODicomNode.h>
-
-#include <vtkImageData.h>
-#include <string>
-#include <vector>
+#include <creaImageIOSystem.h>
+#include <creaImageIOAbstractImageReader.h>
 
 namespace creaImageIO
 {
 
-
-  //=====================================================================
-  class 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
-    /*static*/ const std::vector<std::string>& GetKnownExtensions()  
-    { return mKnownExtensions; }
-    // Returns true iff the file is readable
-    /*static*/ bool CanRead( const std::string& filename, 
-                        const std::string& exclude = "");
-    // Reads the file. Returns an "Unreadable image" picture if fails
-    /*static*/ vtkImageData* Read( const std::string& filename,
-                              const std::string& exclude = "");
+    /// 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);
+    /// Reads and returns the image data. 
+    /// Returns an "Unreadable image" picture if fails
+    vtkImageData* ReadImage( const std::string& filename);
+    
+    /// Reads the attributes of the image.
+    /// Requested attributes names are provided as keys 
+    /// in a string to string map
+    /// On return, the values of the map are the values 
+    /// of the attributes (empty string if not available).
+    void ReadAttributes(const std::string& filename, 
+                       tree::AttributeMapType& attr);
+
+    /// Exclude specific readers 
+    /// TO DO...
+       /// Another function to read attributes for a file
+       void getAttributes(const std::string filename,
+               std::map <std::string , std::string> &infos, std::vector<std::string> i_attr);
+    
 
-    void ReadDicomInfo(const std::string& filename, 
-                      DicomNode* image);
 
   protected:
     
-    /*static*/ void Register(SpecificImageReader*);
+    /// Register a reader
+    void Register( boost::shared_ptr<AbstractImageReader> );
+
+       std::vector<boost::shared_ptr<AbstractImageReader> > mReader;
+    vtkImageData* mUnreadableImage;
+
+    std::string mLastFilename;
+       boost::shared_ptr<AbstractImageReader> mLastReader;
+
+       bool ShallNotRead( const std::string& filename );
 
-    /*static*/ std::vector<SpecificImageReader*> mReader;
-    /*static*/ std::vector<std::string> mKnownExtensions;
-    /*static*/ vtkImageData* mUnreadableImage;
+       void UnRegister(const std::string i_val);
 
-    /*static*/ std::string mLastFilename;
-    /*static*/ SpecificImageReader* mLastReader;
+       std::vector <std::string> mUnReader;
     
   private: