]> Creatis software - creaImageIO.git/blob - src2/creaImageIOImageReader.h
af7dee63897f7cc1b4433e6531954777ae80b9c2
[creaImageIO.git] / src2 / creaImageIOImageReader.h
1 #ifndef __creaImageIOImageReader_h_INCLUDED__
2 #define __creaImageIOImageReader_h_INCLUDED__
3
4 #include <creaImageIOAbstractImageReader.h>
5
6 namespace creaImageIO
7 {
8
9
10   /**
11    * \ingroup ReadWrite
12    */
13   //=====================================================================
14   /// Generic image reader which uses all the specific concrete image reader
15 /// of the lib (tif, jpg, dicom, ...)
16 class ImageReader : virtual public AbstractImageReader
17   {
18   public:
19     ImageReader();
20     ~ImageReader();
21
22     /// Pushes back all kwown extensions (without dot) in the vector given
23     void PushBackExtensions(std::vector<std::string>&);
24
25     /// Returns true iff the file is readable
26     bool CanRead( const std::string& filename);
27     /// Reads and returns the image data. 
28     /// Returns an "Unreadable image" picture if fails
29     vtkImageData* ReadImage( const std::string& filename);
30     
31     /// Reads the attributes of the image.
32     /// Requested attributes names are provided as keys 
33     /// in a string to string map
34     /// On return, the values of the map are the values 
35     /// of the attributes (empty string if not available).
36     void ReadAttributes(const std::string& filename, 
37                         tree::AttributeMapType& attr);
38
39     /// Exclude specific readers 
40     /// TO DO...
41     
42
43   protected:
44     
45     void Register(AbstractImageReader*);
46
47     std::vector<AbstractImageReader*> mReader;
48     vtkImageData* mUnreadableImage;
49
50     std::string mLastFilename;
51     AbstractImageReader* mLastReader;
52     
53   private:
54
55   }; // class ImageReader
56   //=====================================================================
57
58
59
60 } // namespace creaImageIO
61
62
63
64 #endif // #ifndef __creaImageIOImageReader_h_INCLUDED__