ivoflipse / pydicom

Automatically exported from code.google.com/p/pydicom
0 stars 1 forks source link

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open a dataset and set tag = something that's in the dataset
2. a = dataset.get(tag)
3. b = dataset[tag]
4. 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 <module>
    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.

Original issue reported on code.google.com by NikitaTh...@gmail.com on 6 Jul 2010 at 9:37

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 6fca6a2640.

Original comment by darcymason@gmail.com on 10 Sep 2010 at 2:29