suever / pydicom-experimental

pydicom test
0 stars 1 forks source link

dicom dataset walk recursion error #81

Closed suever closed 9 years ago

suever commented 9 years ago

From skantera...@gmail.com on March 05, 2010 11:45:10

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: http://code.google.com/p/pydicom/issues/detail?id=81

suever commented 9 years ago

From darcymason@gmail.com on March 30, 2010 18:08:39

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?

suever commented 9 years ago

From moloney....@gmail.com on April 06, 2010 13:51:02

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

suever commented 9 years ago

From darcymason@gmail.com on April 13, 2010 19:26:22

I believe this is the same error as issue 84 . It should be fixed by revision f54d9aa6b3 .

Status: Fixed