dicom / ruby-dicom

Library for reading, editing and writing DICOM files, as well as handling DICOM network communication. Written in the Ruby language.
http://dicom.rubyforge.org/
GNU General Public License v3.0
178 stars 67 forks source link

The AT VR element should not rewind the stream #31

Closed ciddennis closed 12 years ago

ciddennis commented 12 years ago

I was having an issue where a tag that was vr type AT was not being read correctly . The problem came down to the fact that the read_value(vr, length) rewinded the stream back when type was AT. This is not right at least as far as I can tell. When I bring in the sample from the test cases into Osirx I see the text is value of nil but the current test cases expected a different value. So as far as I can tell the VR type of AT should not rewind the stream.

dicom commented 12 years ago

Hello Cid, thanks for your interest in ruby-dicom.

From your commit alone, Im afraid I dont understand why you want to eliminate the value of 'AT' tags. Obviously, the tag referenced in the spec example has a value. It points to the tag 0010,0010, so it is assigned the value "0010,0010" in ruby-dicom. I think this is a good behaviour.

However, you seem to have run into an issue with your specific file. Perhaps you could explain what goes wrong with your file? Does it contain no value at all, and ruby-dicom crashes because it fails to decode a tag from a nil value? If so we need to update the ruby-dicom code so that it checks for a value before trying to decode it as a tag string. That will be more correct than just ignoring the tag values alltogether.

Regards, Chris

ciddennis commented 12 years ago

Let me find the file in question and I will send it to you so you can see the issue for your self and then I can also give you a better explaintaion.

dicom commented 12 years ago

I have identified an issue where a DICOM file has an AT tag with an invalid value. This will cause ruby-dicom to crash when loading this file it seems. I'll try to adress it as soon as possible.

dicom commented 12 years ago

Please try your particular dicom file against the current master branch. I believe it should be fixed now.