1 from gdcmPython import *
5 ### Get filename from command line or default it
9 FileName = os.path.join(GDCM_DATA_PATH, "test.acr")
12 printLevel = int(sys.argv[2])
16 #if not os.path.isfile(FileName):
17 # print "Cannot open file ", FileName
20 # On debugging purposes uncomment the next line
21 #s = raw_input("Hit any key in this window to exit")
23 ### Build the header element list
24 print FileName, type(FileName)
25 toRead = gdcm.Header(FileName)
26 if not toRead.IsReadable():
27 print "The ", FileName, " file is not readable with gdcm. Sorry."
30 print "##############################################################"
31 print "### Display all the elements and their respective values"
32 print "## found in the ", FileName, " file."
33 print "##############################################################"
34 ###toRead.SetPrintLevel(printLevel)
37 ValDict = toRead.GetEntry()
38 for key in ValDict.keys():
39 print "[%s] = [%s]" %(key, ValDict[key])