1 from gdcmPython import *
4 ### Get filename from command line or default it
8 FileName = os.path.join(GDCM_DATA_PATH, "test.acr")
11 printLevel = int(sys.argv[2])
15 #if not os.path.isfile(FileName):
16 # print "Cannot open file ", FileName
19 # On debugging purposes uncomment the next line
20 #s = raw_input("Hit any key in this window to exit")
22 ### Build the header element list
23 toRead = gdcmHeader(FileName)
24 if not toRead.IsReadable():
25 print "The ", FileName, " file is not readable with gdcm. Sorry."
28 print "##############################################################"
29 print "### Display all the elements and their respective values"
30 print "## found in the ", FileName, " file."
31 print "##############################################################"
32 ###toRead.SetPrintLevel(printLevel)
35 ValDict = toRead.GetEntry()
36 for key in ValDict.keys():
37 print "[%s] = [%s]" %(key, ValDict[key])