suyashkumar / dicom

⚡High Performance DICOM Medical Image Parser in Go.
MIT License
933 stars 136 forks source link

Ignore missing metadata group length field #269

Closed faustoespinal-philips closed 1 year ago

faustoespinal-philips commented 1 year ago

The proposed change adds an additional option flag to the parser which indicates it to ignore the MetaInformationGroupLength element (0x0002, 0x0000). There are many vendors which are still producing DICOM with this tag missing. Other toolkits like pydicom give a warning and dcmtk just reads these files (e.g. their dcmconv utility will fix the file and add the tag but it changes other tags such as ImplementationVersionName).

The idea behind the proposed change is to allow the file to be parsed even when missing this tag and it essentially does not use the PushLimit, PopLimit utilities; but rather peeks into every 4 bytes and reads all the element if it is in group 2. It will stop once it finishes reading group 2 tags. I tested with 2 different ultrasound vendor datasets.

Please let me know of any additional artifacts you would want in order to accept this (e.g. tests)

faustoespinal-philips commented 1 year ago

I've updated the unit tests. I created 2 functions to generate fake header data (one with the 0x2,0x00 element/tag and another without). I am only testing readHeader for this. Let me know what you think.

faustoespinal-philips commented 1 year ago

Hello wanted to make sure that there was no pending action on my part and that you can see the changes I submitted per your latest review comments. Please let me know. Regards.

suyashkumar commented 1 year ago

All good on your end! I will take a look today or later this week! Apologies for the delay, have been quite busy over the past weeks!