]> Creatis software - creaImageIO.git/blob - src/creaImageIODicomImageReader2.h
new Output format and structure for Gimmick. Based on creaImageIO Output document...
[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 #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 DicomImageReader : virtual public AbstractImageReader
25   {
26   public:
27     DicomImageReader();
28     virtual ~DicomImageReader();
29
30         /// Add file extensions read by the reader
31     virtual void PushBackExtensions(std::vector<std::string>&);
32         /// Test if file is read by this reader
33     virtual bool CanRead(const std::string& filename);
34         /// return for a file a 2D VTkImage
35     virtual vtkImageData* ReadImage(const std::string& filename);
36         /// Read the attributes for a file
37     virtual void ReadAttributes(const std::string& filename, 
38                                 tree::AttributeMapType& attr);
39         void ReadAttributes2(const std::string& filename, 
40                                 tree::AttributeMapType& attr);
41
42         /// Another function to read attributes for a file
43         void getAttributes(const std::string filename, std::map <std::string , std::string> &infos, std::vector<std::string> i_attr);
44   private:
45           const std::string GetStringValueFromTag( const gdcm::DataElement& ds);
46           vtkGDCMImageReader *mReader;
47           gdcm::Scanner mscan;
48           bool b_loaded;
49         struct deleter
50         {
51                 void operator()(gdcm::File* p)
52                 {
53                         delete p;
54                 }
55         };
56         friend struct deleter;
57   };
58   //=====================================================================
59
60
61
62 } // namespace creaImageIO
63
64
65
66 #endif // #ifndef __creaImageIODicomImageReader_h_INCLUDED__