-void gdcmElementSet::Print(std::ostream & os) {
- for (TagDocEntryHT::iterator i = tagHT.begin(); i != tagHT.end(); ++i)
- {
- //(i)->second->SetPrintLevel(printLevel);
- (i->second)->Print(os);
+void ElementSet::WriteContent(std::ofstream *fp, FileType filetype)
+{
+ for (TagDocEntryHT::const_iterator i = TagHT.begin();
+ i != TagHT.end();
+ ++i)
+ {
+ // depending on the gdcm::Document type
+ // (gdcm::File; gdcm::DicomDir, (more to come ?)
+ // some groups *cannot* be present.
+ // We hereby protect gdcm for writting stupid things
+ // if they were found in the original document.
+ if ( !MayIWrite( (i->second)->GetGroup() ) )
+ continue;
+ // Skip 'Group Length' element, since it may be wrong.
+ // except for Group 0002
+ if ( (i->second)->GetElement() == 0x0000
+ && (i->second)->GetGroup() != 0x0002 )
+ continue;
+ i->second->WriteContent(fp, filetype);