rii-mango / Daikon

A JavaScript DICOM reader.
Other
220 stars 54 forks source link

Error while reading dicom file #17

Closed KristinWang closed 6 years ago

KristinWang commented 6 years ago

Hi there,

I was trying to load a dicom file through papaya. But it gave an error saying 'offset is outside the bounds of DataView", at line "Daikon.tag.getFloat64()".

Inside this function, the boundary of the FOR loop, is smaller than '1' (in this case, m=0.5), while the iterator 'u' starts from '0', and increment is '1'. So in this case, the line 'a.getFloat64()' throw an error.

I wonder, isn't it reasonable to do Math.floor() on the 'm' ? Any ideas on this would be appreciated!

image

Thanks, Kristin

martinezmj-ims commented 6 years ago

For m to be 0.5, something really must have gone wrong. m should always be a whole number and a.byteLength some multiple of 8. If you can share with me an example image that demonstrates that issue we can get it fixed. Thanks.

KristinWang commented 6 years ago

So nice to hear from you. I have sent some sample images to your github mail. Thanks again for the help. Looking forward to here from you again.

martinezmj-ims commented 6 years ago

Hi. I'm sorry but I never received any email from you. I'm not sure which email GitHub shows. If it's my university email, it might have gotten filtered if you included code in the email content. To email me directly please use: michaeljohnmartinez@gmail.com . Thanks.

KristinWang commented 6 years ago

Hi, I have sent you an email to your gmail (sample images were attached) two days ago. If you didn't receive any email again, please let me know so that I can try to send you the images in other way. Thanks very much.

martinezmj-ims commented 6 years ago

Ok, this should be fixed now. It was more of a data issue than anything else. There were two tags that had a Float Double type but were less than 8 bytes, which isn't valid. I added a check for this such that if the value length is less than 8, it returns 0.

KristinWang commented 6 years ago

Thanks very much. This has been fixed!