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