]> Creatis software - creaImageIO.git/blob - src/creaImageIOAbstractImageReader.h
91a807f2cc27043d13d185d339e116e4f7531b1b
[creaImageIO.git] / src / creaImageIOAbstractImageReader.h
1 #ifndef __creaImageIOAbstractImageReader_h_INCLUDED__
2 #define __creaImageIOAbstractImageReader_h_INCLUDED__
3
4
5 #include <vtkImageData.h>
6 #include <string>
7 #include <map>
8 #include <vector>
9 #include "creaImageIOTreeAttributeMapType.h"
10
11 namespace creaImageIO
12 {
13
14
15   /**
16    * \ingroup IO
17    */
18   
19   //=====================================================================
20   /// Abstract image reader 
21   class AbstractImageReader 
22   {
23   public:
24     AbstractImageReader() {}
25     virtual ~AbstractImageReader() {}
26
27         /// Get the reader's name
28     const std::string& GetName() const { return mName; }
29
30         /// Add file extensions read by the reader
31     virtual void PushBackExtensions(std::vector<std::string>&) {}
32
33         /// Test if file is read by this reader
34     virtual bool CanRead(const std::string& filename) { return false; }
35
36         /// return for a file a 2D VTkImage
37     virtual vtkImageData* ReadImage(const std::string& filename) { return 0; }  
38
39         /// Read the attributes for a file
40     virtual void ReadAttributes(const std::string& filename, 
41                                 tree::AttributeMapType& attr) {}
42
43         /// Another function to read attributes for a file
44         virtual void getAttributes(const std::string filename, std::map <std::string , std::string> &infos, std::vector<std::string> i_attr){}
45   protected:
46
47     /// Set the reader's name
48     void SetName(const std::string& s) { mName = s; }
49   private:
50     std::string mName;
51   };
52   //=====================================================================
53
54
55
56 } // namespace creaImageIO
57
58
59
60 #endif // #ifndef __creaImageIOAbstractImageReader_h_INCLUDED__