suever / pydicom-experimental

pydicom test
0 stars 1 forks source link

dataset.get(tag) != dataset[tag] (different types) #88

Closed suever closed 9 years ago

suever commented 9 years ago

From NikitaTh...@gmail.com on July 06, 2010 17:37:11

What steps will reproduce the problem? 1. Open a dataset and set tag = something that's in the dataset

  1. a = dataset.get(tag)
  2. b = dataset[tag]
  3. assert(a == b)

There's sample code attached. You'll need to change the input filename to something appropriate for your system. What is the expected output? What do you see instead? Objects a and b differ in type and value. Here's the output from the sample code.

me@vodka:~/w/duke/src $ python dicom_test.py 0.9.4-1 <class 'dicom.dataelem.RawDataElement'> <class 'dicom.dataelem.DataElement'> RawDataElement(tag=(0043, 1028), VR='OB', length=80, value='CT01\x00\x00\x00HiSpeed CT/i\x000505z:=|\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', value_tell=3772L, is_implicit_VR=False, is_little_endian=True) (0043, 1028) [Unique image iden] OB: Array of 80 bytes Traceback (most recent call last): File "dicom_test.py", line 20, in assert(a == b) AssertionError What version of the product are you using? I'm using pydicom-0.9.4-1. Please provide any additional information below. This is a hard bug to reproduce. It seems like any non-get() access to the tag will make .get() behave properly later. That includes reversing steps 2 and 3 (i.e. putting dataset[tag] before dataset.get(tag)) or even just printing the dataset.

Attachment: dicom_test.py

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

suever commented 9 years ago

From darcymason@gmail.com on September 09, 2010 19:29:23

This issue was closed by revision 6fca6a2640 .

Status: Fixed