import sys import os sys.path.append('${GDCM_BINARY_DIR}') if os.name == 'posix': sys.path.append('${GDCM_BINARY_DIR}/bin') else: sys.path.append('${GDCM_BINARY_DIR}/bin/Release') sys.path.append('${GDCM_BINARY_DIR}/bin/Debug') from gdcmPython.core import * print "#####################################################################" # Print the DictSet dicts=gdcm.Global.GetDicts() if(not isinstance(dicts,gdcm.DictSet)): raise RuntimeError,"The DictSet hasn't the good type (%s)" % type(dicts) print "DictSet content :" dicts.Print() print "#####################################################################" # Print the Dict (public) pubDict=dicts.GetDefaultPubDict() if(not isinstance(pubDict,gdcm.Dict)): raise RuntimeError,"The public Dict hasn't the good type (%s)" % type(dict) print "Public Dict content :" pubDict.Print() print "#####################################################################" # Print the DictEntry (0010|0020) ENTRY_GR = 0x10 ENTRY_EL = 0x20 entry=pubDict.GetDictEntry(ENTRY_GR,ENTRY_EL) if(not isinstance(entry,gdcm.DictEntry)): raise RuntimeError,"The entry (%04x|%04x) hasn't the good type (%s)" % \ (ENTRY_GR,ENTRY_EL,type(entry)) print "Entry (%04x|%04x) content :" % (ENTRY_GR,ENTRY_EL) entry.Print() # Print the DictEntry (0010|0010) ENTRY_GR = 0x10 ENTRY_EL = 0x10 entry=pubDict.GetDictEntry(ENTRY_GR,ENTRY_EL) if(not isinstance(entry,gdcm.DictEntry)): raise RuntimeError,"The entry (%04x|%04x) hasn't the good type (%s)" % \ (ENTRY_GR,ENTRY_EL,type(entry)) print "Entry (%04x|%04x) content :" % (ENTRY_GR,ENTRY_EL) entry.Print()