]> Creatis software - gdcm.git/blob - gdcmPython/demo/test.py
653b4b8cb4e568dc4f588a524b7c373f68d41cfc
[gdcm.git] / gdcmPython / demo / test.py
1 from gdcmPython import *
2
3 ### Get filename from command line or default it
4 try:
5    FileName = sys.argv[1]
6 except IndexError:
7    FileName = os.path.join(GDCM_DATA_PATH, "test.acr")
8
9 if not os.path.isfile(FileName):
10    print "Cannot open file ", FileName
11    sys.exit()
12
13 # On debugging purposes uncomment the next line
14 #s = raw_input("Hit any key in this window to exit")
15
16 ### Build the header element list
17 toRead = gdcmHeader(FileName)
18 toRead.LoadElements()
19
20 print "##############################################################"
21 print "### Display all the elements and their respective values"
22 print "## found in the ", FileName, " file."
23 print "##############################################################"
24 ValDict = toRead.GetPubElVal()
25 for key in ValDict.keys():
26         print "[%s] = [%s]" %(key, ValDict[key])