suever / pydicom-experimental

pydicom test
0 stars 1 forks source link

IndexError raised on writing zero length AT element #74

Closed suever closed 9 years ago

suever commented 9 years ago

From Ron.Hart...@gmail.com on February 02, 2010 13:41:20

We have some CT images with a tag of VR AT but zero length. The files are read fine, but fail to write with an IndexError in filewriter.py.

Looking at filereader.py, the tag is read as an empty list. The code in filewriter.py tests for a list by attempting to access data_element.value[1] expecting a TypeError but actually gets the IndexError instead.

I have used iter(data_element.value) as a test instead, which better matches the routine in readfile.py and only raises TypeError. This seems to work in our case as the else clause of the try seems to handle the empty list.

I am using pydicom-0.9.3 python-2.6

Ron H-D

Attachment: filewriter.py.diff

Original issue: http://code.google.com/p/pydicom/issues/detail?id=74

suever commented 9 years ago

From darcymason@gmail.com on February 08, 2010 19:10:35

Sorry to take a while to acknowledge this issue and your solution. I've been putting together the package for release 0.9.4, and I should be able to include this in it.

Status: Accepted

suever commented 9 years ago

From darcymason@gmail.com on February 11, 2010 19:54:14

This issue was closed by revision 77ab201249 .

Status: Fixed
Mergedinto: -