]> Creatis software - creaImageIO.git/blob - src2/creaImageIOAbstractImageReader.h
move directory
[creaImageIO.git] / src2 / 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   protected:
44
45     /// Set the reader's name
46     void SetName(const std::string& s) { mName = s; }
47   private:
48     std::string mName;
49   };
50   //=====================================================================
51
52
53
54 } // namespace creaImageIO
55
56
57
58 #endif // #ifndef __creaImageIOAbstractImageReader_h_INCLUDED__