suever / pydicom-experimental

pydicom test
0 stars 1 forks source link

Ambiguous VR data element values #89

Open suever opened 9 years ago

suever commented 9 years ago

From almar.klein@gmail.com on August 18, 2010 08:59:16

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

Attachment: 47EA15B9.DCM

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

suever commented 9 years ago

From almar.klein@gmail.com on August 18, 2010 06:00:31

Woops, sorry for the topic name :/ Same applies to LargestImagePixelValue.

suever commented 9 years ago

From darcymason@gmail.com on September 08, 2010 19:17:49

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.

Summary: Ambiguous VR data element values not converted to numeric
Status: Accepted

suever commented 9 years ago

From darcymason@gmail.com on December 18, 2011 08:20:15

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')

Summary: Ambiguous VR data element values