]> Creatis software - creaImageIO.git/blob - src2/creaImageIOImageReader.h
*** empty log message ***
[creaImageIO.git] / src2 / creaImageIOImageReader.h
1 #ifndef __creaImageIOImageReader_h_INCLUDED__
2 #define __creaImageIOImageReader_h_INCLUDED__
3
4
5 #include <creaImageIOTreeAttributeDescriptor.h>
6
7 #include <vtkImageData.h>
8 #include <string>
9 #include <vector>
10 #include <map>
11
12 namespace creaImageIO
13 {
14
15
16   //=====================================================================
17   /// Image reader of a specific image format
18   class SpecificImageReader;
19   //=====================================================================
20
21   //=====================================================================
22   /// Generic image reader which stores a vector of SpecificImageReader
23   class ImageReader
24   {
25   public:
26     ImageReader();
27     ~ImageReader();
28
29  
30     /// Returns true iff the file is readable
31     bool CanRead( const std::string& filename, 
32                   const std::string& exclude = "");
33     /// Reads and returns the image data. 
34     /// Returns an "Unreadable image" picture if fails
35     vtkImageData* ReadImage( const std::string& filename,
36                              const std::string& exclude = "");
37     
38     /// Reads the attributes of the image.
39     /// Requested attributes names are provided as keys 
40     /// in a string to string map
41     /// On return, the values of the map are the values 
42     /// of the attributes (empty string if not available).
43     void ReadAttributes(const std::string& filename, 
44                         std::map<std::string,std::string>& attr);
45
46     /// Returns the known extensions
47     const std::vector<std::string>& GetKnownExtensions()  
48     { return mKnownExtensions; }
49
50   protected:
51     
52     void Register(SpecificImageReader*);
53
54     std::vector<SpecificImageReader*> mReader;
55     std::vector<std::string> mKnownExtensions;
56     vtkImageData* mUnreadableImage;
57
58     std::string mLastFilename;
59     SpecificImageReader* mLastReader;
60     
61   private:
62
63   }; // class ImageReader
64   //=====================================================================
65
66
67
68 } // namespace creaImageIO
69
70
71
72 #endif // #ifndef __creaImageIOImageReader_h_INCLUDED__