X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=gdcmPython%2Fdemo%2FPrintDict.py.in;h=82537d05d6cc5bcb634ab0ed3057ee10077fb3d9;hb=8a9ebc9b9cb59f2bef1a3c54962c7b9d265e3db2;hp=4a1eb84ac5f27f026938842164118d4faf7ea82e;hpb=f81c61f9ca9f0c33f35e04f2c1c1ffa11a09db59;p=gdcm.git diff --git a/gdcmPython/demo/PrintDict.py.in b/gdcmPython/demo/PrintDict.py.in index 4a1eb84a..82537d05 100644 --- a/gdcmPython/demo/PrintDict.py.in +++ b/gdcmPython/demo/PrintDict.py.in @@ -14,7 +14,7 @@ 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) + raise RuntimeError,"The DictSet hasn't the good type (%s)" % type(dicts) print "DictSet content :" dicts.Print() @@ -22,7 +22,7 @@ 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) + raise RuntimeError,"The public Dict hasn't the good type (%s)" % type(dict) print "Public Dict content :" pubDict.Print() @@ -30,20 +30,20 @@ print "#####################################################################" # Print the DictEntry (0010|0020) ENTRY_GR = 0x10 ENTRY_EL = 0x20 -entry=pubDict.GetDictEntry(ENTRY_GR,ENTRY_EL) +entry=pubDict.GetEntry(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)) + 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() +print "#####################################################################" +# Print the public Dict content +print "dict content :" +entry=pubDict.GetFirstEntry() +while(entry): + print "%4x|%4x [%s] - M%s : %s (%s)" %\ + (entry.GetGroup(),entry.GetElement(),entry.GetVR(),entry.GetVM(), + entry.GetName(),entry.GetKey()) + entry=pubDict.GetNextEntry()