From: jpr Date: Fri, 2 Apr 2004 15:45:06 +0000 (+0000) Subject: * FIX : gdcmParser::WriteEntryTagVRLength emprovement of special treatement X-Git-Tag: Version0.5.bp~259 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=73d23d0da1d6ff657c01d1fb78f6ec876736afb3;hp=3db8b10e21cbdf03f97df6f2ceade9aba5cd022a;p=gdcm.git * FIX : gdcmParser::WriteEntryTagVRLength emprovement of special treatement for Philips spurious Tag fffe|0000 while rewritting Dicom files --- diff --git a/src/gdcmParser.cxx b/src/gdcmParser.cxx index 8c650206..e413ee1e 100644 --- a/src/gdcmParser.cxx +++ b/src/gdcmParser.cxx @@ -374,6 +374,10 @@ bool gdcmParser::Write(FILE *fp, FileType type) { /* TODO : rewrite later, if really usefull +--> Warning : un-updated odd groups lengths can causes pb +--> (xmedcon breaks) +--> to be re- written with future org. + if ( (type == ImplicitVR) || (type == ExplicitVR) ) UpdateGroupLength(false,type); if ( type == ACR) @@ -948,8 +952,14 @@ void gdcmParser::WriteEntryTagVRLength(gdcmHeaderEntry *tag, guint16 el = tag->GetElement(); guint32 lgr = tag->GetReadLength(); + if ( (group == 0xfffe) && (el == 0x0000) ) + // 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 ! + return; + fwrite ( &group,(size_t)2 ,(size_t)1 ,_fp); //group - fwrite ( &el,(size_t)2 ,(size_t)1 ,_fp); //element + fwrite ( &el,(size_t)2 ,(size_t)1 ,_fp); //element if ( type == ExplicitVR ) { @@ -959,12 +969,6 @@ void gdcmParser::WriteEntryTagVRLength(gdcmHeaderEntry *tag, // Hence we skip writing the VR and length and we pad by writing // 0xffffffff - if (el == 0x0000) - // Fix in order to make some MR PHILIPS images e-film readable - // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm: - // we just ignore spurious fffe|0000 tag ! - return; - int ff=0xffffffff; fwrite (&ff,(size_t)4 ,(size_t)1 ,_fp); return;