]> Creatis software - creaImageIO.git/blob - src/creaImageIODicomScanner.h
920975144aea0e8ddd69ae4c03e3d805d62e7312
[creaImageIO.git] / src / creaImageIODicomScanner.h
1 #ifndef __creaImageIODicomScanner_h_INCLUDED__
2 #define __creaImageIODicomScanner_h_INCLUDED__
3
4 #include "creaImageIOTree.h"
5
6 #if defined(USE_GDCM2)
7 #include <gdcmReader.h>
8 #include <vtkGDCMImageReader.h>
9 #include <gdcmScanner.h>
10 #endif
11
12 class vtkGDCMImageReader;
13
14 namespace creaImageIO
15 {
16
17
18   /**
19    * \ingroup IO
20    */
21   
22   //=====================================================================
23   /// Concrete image reader for DICOM images 
24   class DicomImageScanner 
25   {
26   public:
27     DicomImageScanner();
28     virtual ~DicomImageScanner();
29
30         /// Add file extensions read by the reader
31     bool addDirectory(std::string& filename,   std::map<std::string,std::string>& attr);
32
33         /// return for a file a 2D VTkImage
34     virtual vtkImageData* ReadImage(const std::string& filename);
35         /// Read the attributes for a file
36     virtual void ReadAttributes(const std::string& filename, 
37                                 tree::AttributeMapType& attr);
38         void ReadAttributes2(const std::string& filename, 
39                                 tree::AttributeMapType& attr);
40
41          std::string irclean(const std::string& str);
42   private:
43           const std::string GetStringValueFromTag( const gdcm::DataElement& ds);
44           vtkGDCMImageReader *mReader;
45           gdcm::Scanner mscan;
46           bool b_loaded;
47
48   };
49   //=====================================================================
50
51
52
53 } // namespace creaImageIO
54
55
56
57 #endif // #ifndef __creaImageIODicomScanner_h_INCLUDED__