X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=gdcmPython%2Fdemo%2FPrintDict.py.in;h=41d29449f02934274e498f5e2c4c347d62b418e7;hb=4725aeb3e10e02e1e0ad9ac18baf7cc6a3feed6d;hp=03ac74973d9fc41496d7da9fcd5dc8cd087e04cd;hpb=e6ff7dc295436e9463650ea13ab965ce35ae126c;p=gdcm.git diff --git a/gdcmPython/demo/PrintDict.py.in b/gdcmPython/demo/PrintDict.py.in index 03ac7497..41d29449 100644 --- a/gdcmPython/demo/PrintDict.py.in +++ b/gdcmPython/demo/PrintDict.py.in @@ -1,47 +1,41 @@ -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 gdcmConfigDemo import * from gdcmPython.core import * -print "#####################################################################" +print "############################################################## DictSet " # 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() -print "#####################################################################" +print "##################################################### Print Public Dict" # 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() -print "#####################################################################" +print "################################################# DictEntry (0010|0020)" # 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 "#####################################################################" +print "########################################### Print Public Dict Entries " # Print the public Dict content print "dict content :" entry=pubDict.GetFirstEntry() while(entry): - entry.Print() - entry=pubDict.GetNextEntry() + print "%4x|%4x [%s] - VM %s : %s (%s)" %\ + (entry.GetGroup(),entry.GetElement(),entry.GetVR().str(), \ + entry.GetVM(), entry.GetName(),entry.GetKey().str()) + entry=pubDict.GetNextEntry() +print "########################################################## Game over "