]> Creatis software - creaImageIO.git/blob - src/creaImageIOImageReader.h
1bf201c16de8c80e3d2375b1f91be9e6718f0c11
[creaImageIO.git] / src / 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         /// Another function to read attributes for a file
41         void getAttributes(const std::string filename,
42                 std::map <std::string , std::string> &infos, std::vector<std::string> i_attr);
43     
44
45
46   protected:
47     
48     /// Register a reader
49     void Register( boost::shared_ptr<AbstractImageReader> );
50
51         std::vector<boost::shared_ptr<AbstractImageReader> > mReader;
52     vtkImageData* mUnreadableImage;
53
54     std::string mLastFilename;
55         boost::shared_ptr<AbstractImageReader> mLastReader;
56
57         bool ShallNotRead( const std::string& filename );
58
59         void UnRegister(const std::string i_val);
60
61         std::vector <std::string> mUnReader;
62     
63   private:
64
65   }; // class ImageReader
66   //=====================================================================
67
68
69
70 } // namespace creaImageIO
71
72
73
74 #endif // #ifndef __creaImageIOImageReader_h_INCLUDED__