dicom: Error Parsing DICOM with implicit transfer syntax and non-standard tag
I’m getting an error error reading value unexpected EOF
when attempting to parse a DICOM.

After doing a bit of debugging, I determined the problem is occurring because the DICOM has an implicit transfer syntax and a tag that is outside of the DICOM standard (0029,1140 ApplicationHeaderSequence SQ). This is causing the VR to be “UN” and the tag to be read as a string with a length of 4GB, which obviously fails.
Is there a way I can add a custom tag to the DICOM dict so it is correctly identified with a VR of “SQ”? Or is there another way around this problem?
I can upload the DICOM I’m getting this error on later if that will be helpful.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 15 (5 by maintainers)
I tried anonymizing the DICOM I was getting the problem on using Osirix and DicomBrowser. However, when I did this I was no longer getting the error when trying to parse it. The DICOM editing programs kept changing the VL on the tag I was getting the issue on from undefined to a set value when exporting for some reason. So it seems we might need to find another DICOM for testing or make our own as you mentioned.
I did implement a quick fix based on what we discussed and it worked when testing with the original DICOM I was having issues with. So at least we know that should fix the problem.
Hi @suyashkumar, thanks for looking into this!
I did a bit of research and it seems pydicom has recently ran into this issue as well. Their solutions was to parse UN tags with undefined length as SQ tags. This is based on this dicom standard.
This seems like a good solution since it doesn’t require the user to manually input private tags.