]> Creatis software - creaImageIO.git/blob - src/creaImageIODicomImageReader2.h
a267b2993f4ad36d32d772a0f7bb7607ad9644b8
[creaImageIO.git] / src / creaImageIODicomImageReader2.h
1 #ifndef __creaImageIODicomImageReader_h_INCLUDED__
2 #define __creaImageIODicomImageReader_h_INCLUDED__
3
4
5 #include <creaImageIOAbstractImageReader.h>
6 #if defined(USE_GDCM2)
7 #include <gdcmReader.h>
8 #include <vtkGDCMImageReader.h>
9 #include <gdcmScanner.h>
10 #include <gdcmAttribute.h>
11 #endif
12
13 class vtkGDCMImageReader;
14
15 namespace creaImageIO
16 {
17
18
19   /**
20    * \ingroup IO
21    */
22   
23   //=====================================================================
24   /// Concrete image reader for DICOM images 
25   class DicomImageReader : virtual public AbstractImageReader
26   {
27   public:
28     DicomImageReader();
29     virtual ~DicomImageReader();
30
31         /// Add file extensions read by the reader
32     virtual void PushBackExtensions(std::vector<std::string>&);
33         /// Test if file is read by this reader
34     virtual bool CanRead(const std::string& filename);
35         /// return for a file a 2D VTkImage
36     virtual vtkImageData* ReadImage(const std::string& filename);
37         /// Read the attributes for a file
38     virtual void ReadAttributes(const std::string& filename, 
39                                 tree::AttributeMapType& attr);
40         void ReadAttributes2(const std::string& filename, 
41                                 tree::AttributeMapType& attr);
42
43         /// Another function to read attributes for a file
44         void getAttributes(const std::string filename, std::map <std::string , std::string> &infos, std::vector<std::string> i_attr);
45   private:
46           const std::string GetStringValueFromTag( const gdcm::DataElement& ds);
47           vtkGDCMImageReader *mReader;
48           gdcm::Scanner mscan;
49           bool b_loaded;
50         struct deleter
51         {
52                 void operator()(gdcm::File* p)
53                 {
54                         delete p;
55                 }
56         };
57         friend struct deleter;
58   };
59   //=====================================================================
60
61
62
63 } // namespace creaImageIO
64
65
66
67 #endif // #ifndef __creaImageIODicomImageReader_h_INCLUDED__