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