[Dcmlib] Unreadable dicom file
Peter Cech
pcech at vision.ee.ethz.ch
Sun Aug 7 23:52:32 CEST 2005
Hi,
I got a scan in DICOM format that GDCM is unable to read. You can get
anonymized sample from
http://www.vision.ee.ethz.ch/~pcech/bugreports/GDCM-20050807/
Reading fails directly after tag 2001-105f. This tag has value
0xffffffff in the length field (-1 when converted to signed type).
Passing this value to seek method in Document::SkipToNextDocEntry()
causes seeking one byte backward and conequenntly reading nonsense
values for the next tags.
Method Document::SkipToNextDocEntry() is using
DocEntry::GetReadLength(), but in this case DocEntry::GetLenght
should return correct value (zero). If GetReadLength is a correct
method to call, there should be a check for seeking backward (seek
amount argument of seekg is signed integer type).
Unfortunatelly, even after above change the file is not readable.
Another thing I noticed is that there is a mismatch between
documentation and implementation of DocEntry::SetLenght(). Documentation
states "Sets both 'Read Length' and 'Usable Length' of the current Dicom
entry", but the method only sets one variable.
Regards,
Peter Cech
PS: Please CC me your replies, I'm not on the mailing list.
More information about the Dcmlib
mailing list