2 //-----------------------------------------------------------------------------
5 #include "gdcmDocEntry.h"
7 #include "gdcmGlobal.h"
10 #include <iomanip> // for std::ios::left, ...
13 #define MAX_SIZE_PRINT_ELEMENT_VALUE 64
15 //-----------------------------------------------------------------------------
16 // Constructor / Destructor
18 * \ingroup gdcmDocEntry
19 * \brief Constructor from a given gdcmDictEntry
20 * @param in Pointer to existing dictionary entry
22 gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in) {
27 void gdcmDocEntry::Print(std::ostream & os) {
34 //-----------------------------------------------------------------------------
37 * \ingroup gdcmDocEntry
38 * \brief Prints the common part of gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
40 void gdcmDocEntry::PrintCommonPart(std::ostream & os) {
42 printLevel=2; // FIXME
45 unsigned short int g, e;
51 char greltag[10]; //group element tag
57 sprintf(greltag,"%04x|%04x ",g,e);
62 lgth = GetReadLength(); // ReadLength, as opposed to UsableLength
63 if (lgth == 0xffffffff) {
64 sprintf(st,"x(ffff)"); // I said : "x(ffff)" !
65 s.setf(std::ios::left);
66 s << std::setw(10-strlen(st)) << " ";
68 s.setf(std::ios::left);
69 s << std::setw(8) << "-1";
71 sprintf(st,"x(%x)",lgth);
72 s.setf(std::ios::left);
73 s << std::setw(10-strlen(st)) << " ";
75 s.setf(std::ios::left);
76 s << std::setw(8) << lgth;
79 sprintf(st,"x(%x)",o);
80 s << std::setw(10-strlen(st)) << " ";
82 s << std::setw(8) << o;
85 s << "[" << vr << "] ";
88 s.setf(std::ios::left);
89 s << std::setw(66-GetName().length()) << " ";
92 s << "[" << GetName()<< "]";
96 //-----------------------------------------------------------------------------
100 * \ingroup gdcmDocEntry
101 * \brief Gets the full length of the elementary DocEntry (not only value length)
103 guint32 gdcmDocEntry::GetFullLength(void) {
106 if ( IsImplicitVR() )
107 l = l + 8; // 2 (gr) + 2 (el) + 4 (lgth)
109 if ( GetVR()=="OB" || GetVR()=="OW" || GetVR()=="SQ" )
110 l = l + 12; // 2 (gr) + 2 (el) + 2 (vr) + 2 (unused) + 4 (lgth)
112 l = l + 8; // 2 (gr) + 2 (el) + 2 (vr) + 2 (lgth)
117 * \ingroup gdcmDocEntry
118 * \brief Copies all the attributes from an other DocEntry
121 void gdcmDocEntry::Copy (gdcmDocEntry* e) {
122 this->entry = e->entry;
123 this->UsableLength = e->UsableLength;
124 this->ReadLength = e->ReadLength;
125 this->ImplicitVR = e->ImplicitVR;
126 this->Offset = e->Offset;
127 this->printLevel = e->printLevel;
128 // TODO : remove gdcmDocEntry SQDepth
131 bool gdcmDocEntry::isItemDelimitor() {
132 if ( (GetGroup() == 0xfffe) && (GetElement() == 0xe00d) )
138 bool gdcmDocEntry::isSequenceDelimitor() {
139 if (GetGroup() == 0xfffe && GetElement() == 0xe0dd)
145 //-----------------------------------------------------------------------------
149 //-----------------------------------------------------------------------------
152 //-----------------------------------------------------------------------------