From 725267b12a1928251820ad7a3fc363de5fcdf8dc Mon Sep 17 00:00:00 2001 From: jpr Date: Tue, 14 Mar 2006 12:09:18 +0000 Subject: [PATCH] BUG: Newer version of the software on Siemens MR write proper lenght. GDCM was overriding without checking for wrong length first. Can now read old (broken) and new Siemens DICOM files. Thx to Mathieu. --- src/gdcmDocument.cxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 29caf976..06a91f83 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2006/03/10 10:52:10 $ - Version: $Revision: 1.344 $ + Date: $Date: 2006/03/14 12:09:18 $ + Version: $Revision: 1.345 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -1730,9 +1730,20 @@ void Document::FixDocEntryFoundLength(DocEntry *entry, // 'Leonardo' source. Hence, one might consider commenting out the // following fix on efficiency reasons. else if ( gr == 0x0009 && ( elem == 0x1113 || elem == 0x1114 ) ) - { - foundLength = 4; - entry->SetReadLength(4); // a bug is to be fixed ! + { + // Ideally we should check we are in Explicit and double check + // that VR=UL... this is done properly in gdcm2 + if( foundLength == 6 ) + { + gdcmWarningMacro( "Replacing Length from 6 into 4" ); + foundLength = 4; + entry->SetReadLength(4); // a bug is to be fixed ! + } + else if ( foundLength%4 ) + { + gdcmErrorMacro( "This looks like to a buggy Siemens DICOM file." + "The length of this tag seems to be wrong" ); + } } else if ( entry->GetVR() == "SQ" ) -- 2.45.1