]> Creatis software - gdcm.git/blob - gdcmPython/demo/test.py
935345c1cf4fe6ef7e034ab7b47cd545b48bb15e
[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
19 print "##############################################################"
20 print "### Display all the elements and their respective values"
21 print "## found in the ", FileName, " file."
22 print "##############################################################"
23 ValDict = toRead.GetPubElVal()
24 for key in ValDict.keys():
25         print "[%s] = [%s]" %(key, ValDict[key])