ivoflipse / pydicom

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

dicom dataset walk recursion error #81

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Steps to reproduce the problem:
1. d=dicom.ReadFile('./some.dcm')
2. digup_list(d,(0x0008,0x0008))
where digup_list is the function below:

def digup_list(dcmDataset, a):
  """ dig for a nested dicom tag! return a list of tags found"""
  if not isinstance(a, dicom.tag.BaseTag):
    a = dicom.tag.Tag(a)
  ret=[]
  def DigCallback(dataset, attribute):
    if attribute.tag == a:
      ret.append(attribute.value)
  dcmDataset.walk(DigCallback)
  if len(ret) > 0:
    return ret
  else:
    raise KeyError(a)

What is the expected output? What do you see instead?
Normally, this returned a list of tags matching the input tag in version 
0.9.1
Now, (version 0.9.4-1) I get a log printout of errors ending with "maximum 
recursion depth exceeded in cmp" 

From what I can tell, the input dataset "Hasn't been converted from raw 
form yet" so the algorithm is stuck in an infinite loop trying to recurse 
an unconverted dataset.

The reason for even using this technique is that some recent dicoms use a 
nested format so certain tags are not available with .get but are present 
in the header nonetheless.

A follow-up question: What is the fastest way to read dicoms using your 
object if I just want to read the header information in order to sort them 
into series? How does one achieve the speed gains that you advertise?

Thanks a lot, great effort here.

Original issue reported on code.google.com by skantera...@gmail.com on 5 Mar 2010 at 4:45

GoogleCodeExporter commented 9 years ago
Sorry to take a while to get around to this -- I can't reproduce this error in 
0.9.4 (or 0.9.4-1) using several of the 
files in the pydicom testfiles directory -- the call to digup_list returns 
[['ORIGINAL', 'PRIMARY', 'AXIAL']] or 
similar. Can you supply a file (no confidential info in it) or more information 
on where it is known to fail?

Original comment by darcymason@gmail.com on 31 Mar 2010 at 1:08

GoogleCodeExporter commented 9 years ago
This is happening to me when I try to access the value of a private tag in a 
DICOM
file with an Implicit VR.  

Original comment by moloney....@gmail.com on 6 Apr 2010 at 8:51

GoogleCodeExporter commented 9 years ago
I believe this is the same error as issue 84. It should be fixed by revision 
f54d9aa6b3.

Original comment by darcymason@gmail.com on 14 Apr 2010 at 2:26