- Entry=*i;
- (Entry)->WriteCommonPart(fp, filetype);
-
- if (gdcmBinEntry* BinEntry = dynamic_cast< gdcmBinEntry* >(Entry) ) {
- BinEntry->Write(fp);
- return;
- }
- if (gdcmValEntry* ValEntry = dynamic_cast< gdcmValEntry* >(Entry) ) {
- ValEntry->Write(fp);
- return;
- }
- if (gdcmSeqEntry* SeqEntry = dynamic_cast< gdcmSeqEntry* >(Entry) ) {
- SeqEntry->Write(fp,filetype);
- return;
- }
+ // Item Delimitor Item IS the last one of a 'no length' SQItem
+ // (when it exists) we don't write it right now
+ // It will be written outside, because ALL the SQItems are written
+ // as 'no length'
+ if ( (*i)->isItemDelimitor() )
+ break;
+
+ // Fix in order to make some MR PHILIPS images e-film readable
+ // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm:
+ // we just *always* ignore spurious fffe|0000 tag !
+ if ( ((*i)->GetGroup() == 0xfffe) && ((*i)->GetElement() == 0x0000) )
+ break;
+
+ // It's up to the gdcmDocEntry Writter to write the SQItem begin element
+ // (fffe|e000) as a 'no length' one
+ (*i)->Write(fp, filetype);