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 toRead = gdcmHeader(FileName)
25 if not toRead.IsReadable():
26 print "The ", FileName, " file is not readable with gdcm. Sorry."
29 print "##############################################################"
30 print "### Display all the elements and their respective values"
31 print "## found in the ", FileName, " file."
32 print "##############################################################"
33 ###toRead.SetPrintLevel(printLevel)
36 ValDict = toRead.GetEntry()
37 for key in ValDict.keys():
38 print "[%s] = [%s]" %(key, ValDict[key])