GDCM
2.0.18
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 00005 Copyright (c) 2006-2011 Mathieu Malaterre 00006 All rights reserved. 00007 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 00015 #ifndef GDCMDICTCONVERTER_H 00016 #define GDCMDICTCONVERTER_H 00017 00018 #include "gdcmTypes.h" 00019 #include "gdcmVR.h" 00020 #include "gdcmVM.h" 00021 00022 #include <string> 00023 00024 namespace gdcm 00025 { 00026 00027 class DictConverterInternal; 00035 class GDCM_EXPORT DictConverter 00036 { 00037 public: 00038 DictConverter(); 00039 ~DictConverter(); 00040 void SetInputFileName(const char* filename); 00041 const std::string &GetInputFilename() const; 00042 void SetOutputFileName(const char* filename); 00043 const std::string &GetOutputFilename() const; 00044 00045 int GetOutputType() const { 00046 return OutputType; 00047 } 00048 void SetOutputType(int type) { 00049 OutputType = type; 00050 } 00051 const std::string &GetDictName() const; 00052 void SetDictName(const char *name); 00053 00054 void Convert(); 00055 00056 // Leaving them public for now. Not really user oriented but may be 00057 // usefull 00058 static bool ReadVR(const char *raw, VR::VRType &type); 00059 static bool ReadVM(const char *raw, VM::VMType &type); 00060 static bool Readuint16(const char *raw, uint16_t &ov); 00061 00062 enum OutputTypes { 00063 DICT_DEFAULT = 0, 00064 DICT_DEBUG, 00065 DICT_XML 00066 }; 00067 00068 protected: 00069 void WriteHeader(); 00070 void WriteFooter(); 00071 bool ConvertToXML(const char *raw, std::string &cxx); 00072 bool ConvertToCXX(const char *raw, std::string &cxx); 00073 void AddGroupLength(); 00074 00075 private: 00076 DictConverterInternal *Internal; 00077 00078 int OutputType; 00079 }; 00080 00081 } // end namespace gdcm 00082 00083 #endif //GDCMDICTCONVERTER_H