google-code-export / pydicom

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

Ambiguous VR data element values #89

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
01 import dicom
02 ds = dicom.read_file(fname) # where fname is the attached file
03 print repr(ds.SmallestImagePixelValue)

What is the expected output? What do you see instead?
I would expect a python int or float, I get two bytes (str class in Python 2).

What version of the product are you using?
Latest

Original issue reported on code.google.com by almar.klein@gmail.com on 18 Aug 2010 at 12:59

Attachments:

GoogleCodeExporter commented 9 years ago
Woops, sorry for the topic name :/
Same applies to LargestImagePixelValue.

Original comment by almar.klein@gmail.com on 18 Aug 2010 at 1:00

GoogleCodeExporter commented 9 years ago
>  I would expect a python int or float, I get two bytes (str class in Python 
2).

This is somewhat by design of current pydicom -- in this particular example the 
VR is "US or SS", so without looking at other data elements, pydicom does not 
know how to convert and has left the value binary.

The eventual solution is to move into handling some data elements by looking at 
others. This is related also to issue 19 and issue 57, perhaps others.

Original comment by darcymason@gmail.com on 9 Sep 2010 at 2:17

GoogleCodeExporter commented 9 years ago
Wrote a quick script to identify which entries in 2011 dictionary have 
ambiguous VRs, listed by "active" (non-retired) and by retired entries. Might 
be helpful in coming up with a general solution, if can devise patterns for 
resolving the VR:

Active entries (VR, VM, description)
------------------------------------
0x00143050: ('OB or OW', '1', 'Dark Current Counts')
0x00143070: ('OB or OW', '1', 'Air Counts')
0x00280106: ('US or SS', '1', 'Smallest Image Pixel Value')
0x00280107: ('US or SS', '1', 'Largest Image Pixel Value')
0x00280108: ('US or SS', '1', 'Smallest Pixel Value in Series')
0x00280109: ('US or SS', '1', 'Largest Pixel Value in Series')
0x00280120: ('US or SS', '1', 'Pixel Padding Value')
0x00280121: ('US or SS', '1', 'Pixel Padding Range Limit')
0x00281101: ('US or SS', '3', 'Red Palette Color Lookup Table Descriptor')
0x00281102: ('US or SS', '3', 'Green Palette Color Lookup Table Descriptor')
0x00281103: ('US or SS', '3', 'Blue Palette Color Lookup Table Descriptor')
0x00283002: ('US or SS', '3', 'LUT Descriptor')
0x00283006: ('US or OW', '1-n 1', 'LUT Data')
0x00409211: ('US or SS', '1', 'Real World Value Last Value Mapped')
0x00409216: ('US or SS', '1', 'Real World Value First Value Mapped')
0x00603004: ('US or SS', '1', 'Histogram First Bin Value')
0x00603006: ('US or SS', '1', 'Histogram Last Bin Value')
0x54000110: ('OB or OW', '1', 'Channel Minimum Value')
0x54000112: ('OB or OW', '1', 'Channel Maximum Value')
0x5400100a: ('OB or OW', '1', 'Waveform Padding Value')
0x54001010: ('OB or OW', '1', 'Waveform Data')
0x7fe00010: ('OW or OB', '1', 'Pixel Data')

Retired entries (VR, VM, description)
-------------------------------------
0x00280071: ('US or SS', '1', 'Perimeter Value')
0x00280104: ('US or SS', '1', 'Smallest Valid Pixel Value')
0x00280105: ('US or SS', '1', 'Largest Valid Pixel Value')
0x00280110: ('US or SS', '1', 'Smallest Image Pixel Value in Plane')
0x00280111: ('US or SS', '1', 'Largest Image Pixel Value in Plane')
0x00281100: ('US or SS', '3', 'Gray Lookup Table Descriptor')
0x00281111: ('US or SS', '4', 'Large Red Palette Color Lookup Table Descriptor')
0x00281112: ('US or SS', '4', 'Large Green Palette Color Lookup Table 
Descriptor')
0x00281113: ('US or SS', '4', 'Large Blue Palette Color Lookup Table 
Descriptor')
0x00281200: ('US or SS or OW', '1-n 1', 'Gray Lookup Table Data')

Original comment by darcymason@gmail.com on 18 Dec 2011 at 4:20