from gdcmPython import * import sys ### Get filename from command line or default it try: fileName = sys.argv[1] except IndexError: fileName = os.path.join(GDCM_DATA_PATH, "DICOMDIR") try: printLevel = int(sys.argv[2]) except IndexError: printLevel = 1 ### Build the header element list dicomdir = gdcmDicomDir(fileName) if not dicomdir.IsReadable(): print "The '", fileName, "' DicomDir is not readable with gdcm. Sorry." sys.exit() print "##############################################################" print "## Display all the elements and their respective values" print "## found in the ", fileName, " file." print "##############################################################" dicomdir.SetPrintLevel(-1) dicomdir.Print()