From: jpr Date: Mon, 15 Mar 2004 15:38:31 +0000 (+0000) Subject: tiny patch to make e-film readable some e-film breaker MR Philips images X-Git-Tag: Version0.5.bp~292 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2aac3838df30350813968f97c1432a4955eb3927;p=gdcm.git tiny patch to make e-film readable some e-film breaker MR Philips images from Hoptial Guy de Chauliac, Montpellier --- diff --git a/src/gdcmObject.cxx b/src/gdcmObject.cxx index a91aec1f..debbfdd5 100644 --- a/src/gdcmObject.cxx +++ b/src/gdcmObject.cxx @@ -112,7 +112,6 @@ std::string gdcmObject::GetEntryByName(TagName name) { gdcmHeaderEntry *Entry; TagKey key = gdcmDictEntry::TranslateToKey(group, element); if ( ! ptagHT->count(key)) { - // we assume the element belongs to a Public Group (not a shadow one) // we assume a Public Dictionnary *is* loaded gdcmDict *PubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict(); // if the invoqued (group,elem) doesn't exist inside the Dictionary diff --git a/src/gdcmParser.cxx b/src/gdcmParser.cxx index 3fa3cc97..5bee7405 100644 --- a/src/gdcmParser.cxx +++ b/src/gdcmParser.cxx @@ -1056,14 +1056,6 @@ void gdcmParser::WriteEntry(gdcmHeaderEntry *tag, FILE *_fp,FileType type) // TODO (?) tester les echecs en ecriture (apres chaque fwrite) int compte =0; itsTimeToWritePixels = false; - - // === Deal with the length - // -------------------- - if((tag->GetLength())%2==1) - { - tag->SetValue(tag->GetValue()+"\0"); - tag->SetLength(tag->GetReadLength()+1); - } gr = tag->GetGroup(); el = tag->GetElement(); @@ -1071,6 +1063,14 @@ void gdcmParser::WriteEntry(gdcmHeaderEntry *tag, FILE *_fp,FileType type) val = tag->GetValue().c_str(); vr = tag->GetVR(); voidArea = tag->GetVoidArea(); + + // === Deal with the length + // -------------------- + if((tag->GetLength())%2==1) + { + tag->SetValue(tag->GetValue()+"\0"); + tag->SetLength(tag->GetReadLength()+1); + } if ( type == ACR ) { @@ -1090,7 +1090,14 @@ void gdcmParser::WriteEntry(gdcmHeaderEntry *tag, FILE *_fp,FileType type) guint16 z=0, shortLgr; if (gr == 0xfffe) { // NO Value Representation for 'delimiters' - // no length : write ffffffff + // no length : write ffffffff + + // special patch to make some MR PHILIPS + if (el == 0x0000) return; // images e-film readable // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm + // from Hospital Guy de Chauliac, + // Montpellier + // we just ignore spurious fffe|0000 tag ! + fwrite (&ff,(size_t)4 ,(size_t)1 ,_fp); return; // NO value for 'delimiters' }