-void gdcmValEntry::Write(FILE *fp, FileType filetype) {
- std::string vr=GetVR();
- int lgr=GetLength();
- if (vr == "US" || vr == "SS") {
- // some 'Short integer' fields may be mulivaluated
- // each single value is separated from the next one by '\'
- // we split the string and write each value as a short int
- std::vector<std::string> tokens;
- tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
- Tokenize (GetValue(), tokens, "\\");
- for (unsigned int i=0; i<tokens.size();i++) {
- guint16 val_uint16 = atoi(tokens[i].c_str());
- void *ptr = &val_uint16;
- fwrite ( ptr,(size_t)2 ,(size_t)1 ,fp);
- }
- tokens.clear();
- return;
+void ValEntry::Write(std::ofstream* fp, FileType filetype)
+{
+ DocEntry::Write(fp, filetype);
+
+ //std::cout << "=====================================" << GetVR() << std::endl;
+
+ if ( GetGroup() == 0xfffe )
+ {
+ return; //delimitors have NO value
+ }
+
+ std::string vr = GetVR();
+ int lgr = GetReadLength();
+ if (vr == "US" || vr == "SS")
+ {
+ // some 'Short integer' fields may be mulivaluated
+ // each single value is separated from the next one by '\'
+ // we split the string and write each value as a short int
+ std::vector<std::string> tokens;
+ tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
+ Util::Tokenize (GetValue(), tokens, "\\");
+ for (unsigned int i=0; i<tokens.size();i++)
+ {
+ uint16_t val_uint16 = atoi(tokens[i].c_str());
+ binary_write( *fp, val_uint16);