Kiyokawa / pydicom

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

ValueError: invalid literal for int() with base 10: 'F' #152

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

import sys
import dicom
import dicom_dao
import json

filename = sys.argv[1]

try:
    dcmfile = dicom.read_file(<file in attachement>, force=True )
except:
    print "DICOM not readable"
    raise

dicomJson = dicom_dao.pydicom2json(dcmfile)
jsdmp = json.dumps(dicomJson[0])

print jsdmp

What is the expected output? What do you see instead?

The expected output is the json document for the dicom header of the file

What version of the product are you using?
pydicom-0.9.8

Additional information including the trace of the error. 

dcm.remove_private_tags()  # No support for now
  File "/Library/Python/2.7/site-packages/dicom/dataset.py", line 459, in remove_private_tags
    self.walk(RemoveCallback)
  File "/Library/Python/2.7/site-packages/dicom/dataset.py", line 568, in walk
    data_element = self[tag]
  File "/Library/Python/2.7/site-packages/dicom/dataset.py", line 285, in __getitem__
    self[tag] = DataElement_from_raw(data_elem, character_set)
  File "/Library/Python/2.7/site-packages/dicom/dataelem.py", line 338, in DataElement_from_raw
    value = convert_value(VR, raw, encoding)
  File "/Library/Python/2.7/site-packages/dicom/values.py", line 193, in convert_value
    value = converter(byte_string, is_little_endian, num_format)
  File "/Library/Python/2.7/site-packages/dicom/values.py", line 66, in convert_IS_string
    return MultiString(byte_string, valtype=dicom.valuerep.IS)
  File "/Library/Python/2.7/site-packages/dicom/valuerep.py", line 212, in MultiString
    return valtype(val) if val else val
  File "/Library/Python/2.7/site-packages/dicom/valuerep.py", line 172, in __new__
    newval = super(IS, cls).__new__(cls, val)
ValueError: invalid literal for int() with base 10: 'F'

Original issue reported on code.google.com by juanprie...@gmail.com on 13 Oct 2014 at 11:25

Attachments:

GoogleCodeExporter commented 8 years ago
This is a temporary workaround

https://code.google.com/r/juanprietob-pydicom/source/detail?r=a1a734ff4e21dd66bd
b9db6acda7659069e0c972

Original comment by juanprie...@gmail.com on 14 Oct 2014 at 1:36