2 //-----------------------------------------------------------------------------
9 #include "gdcmDictEntry.h"
12 //-----------------------------------------------------------------------------
14 * \ingroup gdcmDocEntry
15 * \brief The dicom header of a Dicom file contains a set of such entries
16 * (when successfuly parsed against a given Dicom dictionary)
18 class GDCM_EXPORT gdcmDocEntry {
20 gdcmDocEntry(gdcmDictEntry*);
22 /// Returns the Dicom Group number of the current Dicom Header Entry
23 inline guint16 GetGroup(void) { return entry->GetGroup(); };
25 /// Returns the Dicom Element number of the current Dicom Header Entry
26 inline guint16 GetElement(void) { return entry->GetElement();};
28 /// Returns the 'key' of the current Dicom Header Entry
29 inline std::string GetKey(void) { return entry->GetKey(); };
31 /// \brief Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom
32 /// Dictionnary of the current Dicom Header Entry
33 inline std::string GetName(void) { return entry->GetName(); };
35 /// \brief Returns the 'Value Representation' (e.g. "PN" : Person Name,
36 /// "SL" : Signed Long), found in the Dicom Header or in the Dicom
37 /// Dictionnary, of the current Dicom Header Entry
38 inline std::string GetVR(void) { return entry->GetVR(); };
40 /// \brief Returns offset (since the beginning of the file, including
41 /// the File Pramble, if any) of the value of the current Dicom HeaderEntry
42 /// \warning offset of the *value*, not of the Dicom Header Entry
43 inline size_t GetOffset(void) { return Offset; };
45 /// \brief Returns the actual value length of the current Dicom Header Entry
46 /// \warning this value is not *allways* the one stored in the Dicom Header
47 /// in case of well knowned bugs
48 inline guint32 GetLength(void) { return UsableLength; };
50 /// \brief Returns the 'read length' of the current Dicom Header Entry
51 /// \warning this value is the one stored in the Dicom Header but not
52 /// mandatoryly the one thats's used (in case on SQ, or delimiters,
53 /// the usable length is set to zero)
54 inline guint32 GetReadLength(void) { return ReadLength; };
56 /// Sets the 'Value Representation' of the current Dicom Header Entry
57 inline void SetVR(std::string v) { entry->SetVR(v); };
59 /// \brief Sets both 'Read Length' and 'Usable Length' of the current
60 /// Dicom Header Entry
61 inline void SetLength(guint32 l) { ReadLength=UsableLength=l;};
63 // The following 3 members, for internal use only !
65 /// \brief Sets only 'Read Length' (*not* 'Usable Length') of the current
66 /// Dicom Header Entry
67 inline void SetReadLength(guint32 l) { ReadLength = l; };
69 /// \brief Sets only 'Usable Length' (*not* 'Read Length') of the current
70 /// Dicom Header Entry
71 inline void SetUsableLength(guint32 l) { UsableLength = l; };
73 /// \brief Sets the offset of the Dicom Element
74 /// \warning use with caution !
75 /// @param of offset to be set
76 inline void gdcmDocEntry::SetOffset(size_t of) { Offset = of; };
78 /// Sets to TRUE the ImplicitVr flag of the current Dicom Element
79 inline void gdcmDocEntry::SetImplicitVR(void) { ImplicitVR = true; };
81 /// \brief Tells us if the current Dicom Element was checked as ImplicitVr
82 /// @return true if the current Dicom Element was checked as ImplicitVr
83 inline bool gdcmDocEntry::IsImplicitVR(void) { return ImplicitVR; };
85 /// \brief Tells us if the VR of the current Dicom Element is Unkonwn
86 /// @return true if the VR is unkonwn
87 inline bool gdcmDocEntry::IsVRUnknown(void)
88 { return entry->IsVRUnknown(); };
90 /// \brief Sets the DicEntry of the current Dicom Element
91 /// @param NewEntry pointer to the DictEntry
92 inline void gdcmDocEntry::SetDictEntry(gdcmDictEntry *NewEntry)
93 { entry = NewEntry; };
95 /// \brief Gets the DicEntry of the current Dicom Element
96 /// @return The DicEntry of the current Dicom Element
97 gdcmDictEntry * gdcmDocEntry::GetDictEntry(void) { return entry; };
99 /// \brief Sets the print level for the Dicom Header Elements
100 /// \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
101 void SetPrintLevel(int level) { printLevel = level; };
103 void Print (std::ostream & os = std::cout);
105 /// Gets the depth level of a Dicom Header Entry embedded in a SeQuence
106 inline int GetSQDepthLevel(void) { return (SQDepthLevel); };
108 guint32 GetFullLength(void);
110 void Copy(gdcmDocEntry *doc);
113 // FIXME: In fact we should be more specific and use :
114 // friend gdcmDocEntry * gdcmHeader::ReadNextElement(void);
115 friend class gdcmHeader;
117 /// Sets the depth level of a Dicom Header Entry embedded in a SeQuence
118 inline void SetSQDepthLevel(int depthLevel) { SQDepthLevel = depthLevel; };
121 gdcmDictEntry *entry;
123 /// \brief Updated from ReadLength, by FixFoungLentgh() for fixing a bug
124 /// in the header or helping the parser going on
125 guint32 UsableLength;
127 /// \brief Length actually read on disk (before FixFoundLength). ReadLength
128 /// will be updated only when FixFoundLength actually fixes a bug in the
129 /// header, not when it performs a trick to help the Parser going on.
132 /// \brief Even when reading explicit vr files, some elements happen to
133 /// be implicit. Flag them here since we can't use the entry->vr without
134 /// breaking the underlying dictionary.
137 /// Offset from the begining of file for direct user access
140 /// How many details are to be printed (value : 0,1,2)
143 /// Gives the depth level of elements inside SeQuences
147 //-----------------------------------------------------------------------------