4 sys.path.append('${GDCM_BINARY_DIR}')
6 sys.path.append('${GDCM_BINARY_DIR}/bin')
8 sys.path.append('${GDCM_BINARY_DIR}/bin/Release')
9 sys.path.append('${GDCM_BINARY_DIR}/bin/Debug')
11 from gdcmPython.core import *
13 ### Get filename from command line or default it
15 fileName = sys.argv[1]
17 fileName = os.path.join(GDCM_DATA_ROOT, "test.acr")
20 printLevel = int(sys.argv[2])
24 ### Build the file element list
25 print fileName, type(fileName)
26 file = gdcm.File(fileName)
27 if not file.IsReadable():
28 raise RuntimeError,"The '%s' file is not readable with gdcm." % fileName
30 print "##############################################################"
31 print "### Display all the elements and their respective values"
32 print "## found in the ", fileName, " file."
33 print "##############################################################"
35 val=file.GetFirstEntry()
39 val=file.GetNextEntry()
42 print "##############################################################"
43 val=file.GetFirstEntry()
45 if(isinstance(val,gdcm.ValEntryPtr)):
46 print "Val %04d|%04d [%s] : %s" % (val.GetGroup(),val.GetElement(),
47 val.GetName(),val.GetValue())
49 print "Bin %04d|%04d [%s] : %s" % (val.GetGroup(),val.GetElement(),
50 val.GetName(),val.GetValue())
51 val=file.GetNextEntry()