creaImageIODicomImageReader2.h

Go to the documentation of this file.
00001 #ifndef __creaImageIODicomImageReader_h_INCLUDED__
00002 #define __creaImageIODicomImageReader_h_INCLUDED__
00003 
00004 
00005 #include <creaImageIOAbstractImageReader.h>
00006 #if defined(USE_GDCM2)
00007 #include <gdcmReader.h>
00008 #include <vtkGDCMImageReader.h>
00009 #include <gdcmScanner.h>
00010 #include <gdcmAttribute.h>
00011 #endif
00012 
00013 class vtkGDCMImageReader;
00014 
00015 namespace creaImageIO
00016 {
00017 
00018 
00023   //=====================================================================
00025   class DicomImageReader : virtual public AbstractImageReader
00026   {
00027   public:
00028     DicomImageReader();
00029     virtual ~DicomImageReader();
00030 
00032     virtual void PushBackExtensions(std::vector<std::string>&);
00034     virtual bool CanRead(const std::string& filename);
00036     virtual vtkImageData* ReadImage(const std::string& filename);
00038     virtual void ReadAttributes(const std::string& filename, 
00039                                 tree::AttributeMapType& attr);
00040         void ReadAttributes2(const std::string& filename, 
00041                                 tree::AttributeMapType& attr);
00042 
00044         void getAttributes(const std::string filename, std::map <std::string , std::string> &infos, std::vector<std::string> i_attr);
00045   private:
00046           const std::string GetStringValueFromTag( const gdcm::DataElement& ds);
00047           vtkGDCMImageReader *mReader;
00048           gdcm::Scanner mscan;
00049           bool b_loaded;
00050         struct deleter
00051         {
00052                 void operator()(gdcm::File* p)
00053                 {
00054                         delete p;
00055                 }
00056         };
00057         friend struct deleter;
00058   };
00059   //=====================================================================
00060 
00061 
00062 
00063 } // namespace creaImageIO
00064 
00065 
00066 
00067 #endif // #ifndef __creaImageIODicomImageReader_h_INCLUDED__