Error in parsing DICOM file with invalid Patient field

137 views
Skip to first unread message

MH

unread,
May 30, 2012, 11:59:03 AM5/30/12
to ruby-dicom
Hi,

I'm a new user of the DICOM Ruby library and find it extremely helpful
so far. One of the problems I'm trying to solve is that certain
UltraSound machines store different Study ID's in each image and hence
each image comes in as a different study when loaded in our PACS.
Hence I created a small script to get the Study ID from the first dcm
file and populate the same in the other DCM files for that particular
study. ( all images for each study is in its own folder.. so I go thru
all the files in a particular folder.. ). So it works as expected..
But the issue I am facing is with the DICOM Parse. If the incoming DCM
file has any inconsistency, then the parse fails. For e.g., 1 of my
clients does not have an option to insert the Patient DOB in the
studies and all they can enter is the age. i.e. 30Y etc.. And since
the Patient DOB is a Date field (type DA), the parse fails.

Is there a way to work around this problem ? If Parse could ignore
this , then that would be ideal. Is there a way I could tweak Parse to
ignore this error ?

If not, then is there an easy solution where I can just update all the
DCM Patient DOB fields with some temporary fixed date OR maybe
calculate based on the age and then update the dcm files prior to
parsing them.

Any help would be highly appreciated.

Thanks,
Mitesh.

Christoffer Lervåg

unread,
Jun 2, 2012, 6:32:48 AM6/2/12
to ruby-...@googlegroups.com
Hello Mitesh,
and welcome to the forum.

What needs to be established here, is whether you have a valid or invalid dicom file. From your post, it seems to me that ruby-dicom fails to read a certain kind of your dicom files, right? My question is, does this dicom file successfully open in other freeware/open source dicom viewers/toolkits? Please try this. If it fails in these other programs too, than your dicom file is simply invalid, and your vendor should be held responsible for.

So we have two scenarios:
1. Invalid dicom file.
An option would be to make your own customized version of ruby dicom to handle this specific incorrect type of dicom file. It would require modifying the source code of ruby-dicom. Depending on your level of ruby experience, it may be an easy or difficult task.

2. Valid dicom file, but ruby-dicom incorrectly fails.
If this is the case, I would suggest you send me this particular file and I will have a look at it to possible fix ruby-dicom. I am on vacation right now though, so dont expect a speedy response.

I guess another option is that I misunderstood and that the dicom file is not invalid, and instead your only problem is that the format of your date field is wrong. If this is the case, it should be very straight forward to fix this in a ruby script using ruby-dicom!

Best regards,
Chris
Reply all
Reply to author
Forward
0 new messages