Menu

#32 Difficult to access private tags from python

2.9
open
1
2017-07-26
2009-01-26
No

It is difficult to access private DICOM tag values when using the gdcm2 python binding. Public tags are extracted just fine with the code in both "Wrapping\Python\TestPythonFilter.py" and "MediaStorageAndFileFormat\Python\TestStringFilter.py", but both the StringFilter and PythonFilter interfaces seems unable to return any private tags.

By looking in the "Wrapping\Python\gdcmPythonFilter.cxx" and "Source\MediaStorageAndFileFormat\gdcmStringFilter.cxx" sourcescode it seems like PythonFilter::ToPyObject and StringFilter::ToStringPair deliberately return 0/empty when requesting private tags, which I find strange.

A functioning, yet suboptimal, work-around to access private tag values is:
print ds.GetDataElement(priv_tag).GetValue()

Discussion

  • Mathieu Malaterre

    • priority: 5 --> 1
     
  • Mathieu Malaterre

    • Group: --> 2.5
     

Log in to post a comment.