00001 // gdcmHeaderEntry.h 00002 //----------------------------------------------------------------------------- 00003 #ifndef GDCMHeaderEntry_H 00004 #define GDCMHeaderEntry_H 00005 00006 #include <iostream> 00007 #include <stdio.h> 00008 00009 #include "gdcmDictEntry.h" 00010 class gdcmHeader; 00011 00012 //----------------------------------------------------------------------------- 00013 /* 00014 * The dicom header of a Dicom file contains a set of such entries 00015 * (when successfuly parsed against a given Dicom dictionary) 00016 */ 00017 class GDCM_EXPORT gdcmHeaderEntry { 00018 public: 00019 gdcmHeaderEntry(gdcmDictEntry*); 00020 00021 inline guint16 GetGroup(void) { return entry->GetGroup(); }; 00022 inline guint16 GetElement(void) { return entry->GetElement();}; 00023 inline std::string GetKey(void) { return entry->GetKey(); }; 00024 inline std::string GetName(void) { return entry->GetName(); }; 00025 inline std::string GetVR(void) { return entry->GetVR(); }; 00026 inline std::string GetValue(void) { return value; }; 00027 00028 inline void * GetVoidArea(void) { return voidArea; }; 00029 inline size_t GetOffset(void) { return Offset; }; 00030 inline guint32 GetLength(void) { return UsableLength; }; 00031 00032 inline void SetVR(std::string v) { entry->SetVR(v); }; 00033 inline void SetLength(guint32 l) { ReadLength=UsableLength=l;}; 00034 00035 // The following 3 members, for internal use only ! 00036 inline void SetReadLength(guint32 l) { ReadLength = l; }; 00037 inline void SetUsableLength(guint32 l){ UsableLength = l; }; 00038 inline guint32 GetReadLength(void) { return ReadLength;}; 00039 00040 inline void SetValue(std::string val) { value = val; }; 00041 inline void SetVoidArea(void * area) { voidArea = area; }; 00042 00049 inline void gdcmHeaderEntry::SetOffset(size_t of) { Offset = of; }; 00050 00055 inline void gdcmHeaderEntry::SetImplicitVR(void) { ImplicitVR = true; }; 00056 00062 inline bool gdcmHeaderEntry::IsImplicitVR(void) { return ImplicitVR; }; 00063 00069 inline bool gdcmHeaderEntry::IsVRUnknown(void) { return entry->IsVRUnknown(); }; 00070 00076 inline void gdcmHeaderEntry::SetDictEntry(gdcmDictEntry *NewEntry) { 00077 entry = NewEntry; 00078 }; 00079 00085 gdcmDictEntry * gdcmHeaderEntry::GetDictEntry(void) { return entry; }; 00086 00092 void SetPrintLevel(int level) { printLevel = level; }; 00093 void Print (std::ostream & os = std::cout); 00094 00095 private: 00096 // FIXME: In fact we should be more specific and use : 00097 // friend gdcmHeaderEntry * gdcmHeader::ReadNextElement(void); 00098 friend class gdcmHeader; 00099 00100 // Variables 00101 gdcmDictEntry *entry; 00102 guint32 UsableLength; // Updated from ReadLength, by FixFoungLentgh() 00103 // for fixing a bug in the header or helping 00104 // the parser going on 00105 00106 guint32 ReadLength; // Length actually read on disk 00107 // (before FixFoundLength) 00108 // ReadLength will be updated only when 00109 // FixFoundLength actually fixes a bug in the header, 00110 // not when it performs a trick to help the Parser 00111 // going on. 00112 // *for internal* use only 00113 00114 bool ImplicitVR; // Even when reading explicit vr files, some 00115 // elements happen to be implicit. Flag them here 00116 // since we can't use the entry->vr without breaking 00117 // the underlying dictionary. 00118 00119 00120 std::string value; 00121 void *voidArea; // unsecure memory area to hold 'non string' values 00122 // (ie : Lookup Tables, overlays) 00123 size_t Offset; // Offset from the begining of file for direct user access 00124 int printLevel; 00125 }; 00126 00127 //----------------------------------------------------------------------------- 00128 #endif