-
Notifications
You must be signed in to change notification settings - Fork 598
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
Error parsing image - nested sequences? #180
Comments
I have tried and failed to commit a new branch. Anyhow, this worked for me: // handle nested sequences of explicit length
if (dataElement.vr == "SQ" && sequences.length > 1 ) {
sequences[sequences.length - 2].vlCount -= 4; // offsets the +12 below
}
// end of sequence with explicit length
if ( dataElement.vr !== "SQ" && sequences.length !== 0 ) {
var last = sequences.length - 1;
sequences[last].vlCount += tagOffset;
// check if we have reached the sequence vl
while ( sequences.length > 0 && sequences[last].vlCount === sequences[last].vl ) {
// last count + size of a sequence
var lastVlCount = sequences[last].vlCount + 12;
// remove last sequence
sequences = sequences.slice(0, -1);
// add nested sequence vl
if ( sequences.length !== 0 ) {
last = sequences.length - 1;
sequences[last].vlCount += lastVlCount;
}
}
} |
there are so many problems with current dicomParser.js you need to update dicomParser.js with new one that is |
Thanks for your code @bisol! |
Your comment is not really helping the issue @pervez8ktt... Feel free to contribute to the dcmbench project to prove your point! |
@ivmartel |
Ok, got it, the problem is implicit/explicit transfer syntax. The 4 bytes are used to store the VR in the explicit case (see DICOM sect_7.5.html#table_7.5-1) which was what I tested against. Yours is implicit so no need for those 4 bytes. |
I'm using DWV 0.11.1, and got this error while trying to display an image:
I've traced it to these tests on dwv.dicom.DicomParser.prototype.parse
Seems like it can't handle a sequence with another sequence as it's last item.
This site limits attachments by file extension, so I uploaded the DICOM file renamed to png :p
The text was updated successfully, but these errors were encountered: