1 from gdcmConfigDemo import *
2 from gdcmPython.core import *
4 print "#####################################################################"
6 dicts=gdcm.Global.GetDicts()
7 if(not isinstance(dicts,gdcm.DictSet)):
8 raise RuntimeError,"The DictSet hasn't the good type (%s)" % type(dicts)
9 print "DictSet content :"
12 print "#####################################################################"
13 # Print the Dict (public)
14 pubDict=dicts.GetDefaultPubDict()
15 if(not isinstance(pubDict,gdcm.Dict)):
16 raise RuntimeError,"The public Dict hasn't the good type (%s)" % type(dict)
17 print "Public Dict content :"
20 print "#####################################################################"
21 # Print the DictEntry (0010|0020)
24 entry=pubDict.GetEntry(ENTRY_GR,ENTRY_EL)
25 if(not isinstance(entry,gdcm.DictEntry)):
26 raise RuntimeError,"The entry (%04x|%04x) hasn't the good type (%s)" % \
27 (ENTRY_GR,ENTRY_EL,type(entry))
28 print "Entry (%04x|%04x) content :" % (ENTRY_GR,ENTRY_EL)
31 print "#####################################################################"
32 # Print the public Dict content
33 print "dict content :"
34 entry=pubDict.GetFirstEntry()
36 print "%4x|%4x [%s] - M%s : %s (%s)" %\
37 (entry.GetGroup(),entry.GetElement(),entry.GetVR(),entry.GetVM(),
38 entry.GetName(),entry.GetKey())
39 entry=pubDict.GetNextEntry()