+ * @param Entry
+ * @return Transformed entry value
+ */
+std::string gdcmParser::GetHeaderEntryValue(gdcmHeaderEntry *Entry)
+{
+ if ( (IsHeaderEntryAnInteger(Entry)) && (Entry->IsImplicitVR()) )
+ {
+ std::string val=Entry->GetValue();
+ std::string vr=Entry->GetVR();
+ guint32 length = Entry->GetLength();
+ std::ostringstream s;
+ int nbInt;
+
+ // When short integer(s) are expected, read and convert the following
+ // n * 2 bytes properly i.e. as a multivaluated strings
+ // (each single value is separated fromthe next one by '\'
+ // as usual for standard multivaluated filels
+ // Elements with Value Multiplicity > 1
+ // contain a set of short integers (not a single one)
+
+ if (vr == "US" || vr == "SS")
+ {
+ guint16 NewInt16;
+
+ nbInt = length / 2;
+ for (int i=0; i < nbInt; i++)
+ {
+ if(i!=0)
+ s << '\\';
+ NewInt16 = (val[2*i+0]&0xFF)+((val[2*i+1]&0xFF)<<8);
+ NewInt16 = SwapShort(NewInt16);
+ s << NewInt16;
+ }
+ }
+
+ // When integer(s) are expected, read and convert the following
+ // n * 4 bytes properly i.e. as a multivaluated strings
+ // (each single value is separated fromthe next one by '\'
+ // as usual for standard multivaluated filels
+ // Elements with Value Multiplicity > 1
+ // contain a set of integers (not a single one)
+ else if (vr == "UL" || vr == "SL")
+ {
+ guint32 NewInt32;
+
+ nbInt = length / 4;
+ for (int i=0; i < nbInt; i++)
+ {
+ if(i!=0)
+ s << '\\';
+ NewInt32= (val[4*i+0]&0xFF)+((val[4*i+1]&0xFF)<<8)+
+ ((val[4*i+2]&0xFF)<<16)+((val[4*i+3]&0xFF)<<24);
+ NewInt32=SwapLong(NewInt32);
+ s << NewInt32;
+ }
+ }
+#ifdef GDCM_NO_ANSI_STRING_STREAM
+ s << std::ends; // to avoid oddities on Solaris
+#endif //GDCM_NO_ANSI_STRING_STREAM
+ return(s.str());
+ }
+
+ return(Entry->GetValue());
+}
+
+/**
+ * \brief Get the reverse transformed value of the header entry. The VR
+ * value is used to define the reverse transformation to operate on
+ * the value
+ * \warning NOT end user intended method !
+ * @param Entry
+ * @return Reverse transformed entry value
+ */
+std::string gdcmParser::GetHeaderEntryUnvalue(gdcmHeaderEntry *Entry)
+{
+ if ( (IsHeaderEntryAnInteger(Entry)) && (Entry->IsImplicitVR()) )
+ {
+ std::string vr=Entry->GetVR();
+ std::ostringstream s;
+ std::vector<std::string> tokens;
+
+ if (vr == "US" || vr == "SS")
+ {
+ guint16 NewInt16;
+
+ tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
+ Tokenize (Entry->GetValue(), tokens, "\\");
+ for (unsigned int i=0; i<tokens.size();i++)
+ {
+ NewInt16 = atoi(tokens[i].c_str());
+ s<<(NewInt16&0xFF)<<((NewInt16>>8)&0xFF);
+ }
+ tokens.clear();
+ }
+ if (vr == "UL" || vr == "SL")
+ {
+ guint32 NewInt32;
+
+ tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
+ Tokenize (Entry->GetValue(), tokens, "\\");
+ for (unsigned int i=0; i<tokens.size();i++)
+ {
+ NewInt32 = atoi(tokens[i].c_str());
+ s<<(char)(NewInt32&0xFF)<<(char)((NewInt32>>8)&0xFF)
+ <<(char)((NewInt32>>16)&0xFF)<<(char)((NewInt32>>24)&0xFF);
+ }
+ tokens.clear();
+ }
+
+#ifdef GDCM_NO_ANSI_STRING_STREAM
+ s << std::ends; // to avoid oddities on Solaris
+#endif //GDCM_NO_ANSI_STRING_STREAM
+ return(s.str());
+ }
+
+ return(Entry->GetValue());
+}
+
+/**
+ * \brief Skip a given Header Entry
+ * \warning NOT end user intended method !
+ * @param entry