New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue #114 - Fail to find the image element in a DICOM file with private Sequence tags #115
Conversation
…private Sequence tags
…rectly peeked rather than skipping over them.
@Zaid-Safadi Do you have any sample DICOM or test cases we can incorporate around this PR? |
…rectly peeked rather than skipping over them. (cherry picked from commit c827f86)
Hey @yagni , unfortunately I can't share the sample I have. I can't get the file anonymized because of the private elements that are needed for this. |
@Zaid-Safadi Here is my 2cent on the issue. Looking at your patch, here is my understanding:
Now in your case you seem to have found a case where the Private Sequence is declared with VR=UN, but the encoding of the nested Data Element is Explicit Little Endian. If this is the case, this is illegal (per DICOM standard). To convince yourself (since you cannot share your DICOM DataSet), here are two ways to check: [Let's consider that the private sequence described above is at tag XXXX,YYYYY] Solution 1:
Solution 2:
Pay attention above gdcmdump != dcmdump. In any case you should be able to reproduce the bug with a public DICOM dataset containing Sequence, there is nothing special about Private Tag in the DICOM standard (at least for the encoding of the Data Element). |
@malaterre I’m afraid your understanding of the issue is not accurate. Simply, the parser is trying to parse a private element in an implicit VR DS because it wrongly assumes it’s a sequence when it may or may not be. According to the standard the parser should just skip over the element all together which what this fix does. |
@Zaid-Safadi! I didn't realize you had merge rights. Thanks for wrapping up this issue 🙏 |
The PR fix and prevent the behavior of the parser "trying to detect and parse private sequences as they not necessarily follow the DICOM standard" causing the parser state to be corrupt.