]> Creatis software - gdcm.git/blobdiff - gdcmPython/demo/explore.py
* gdcmPython/Makefile.am fixed linking against libstdc++
[gdcm.git] / gdcmPython / demo / explore.py
index c11a9aebb94d87ca1e7b41d4972ae0ae28c7d6c5..af124bb64dcf9cf3465ebb2a6cd157e551a9282b 100644 (file)
@@ -1,8 +1,16 @@
-from load import *
+from gdcmPython import *
 
-########## Real usage of Pygdcm starts here
-toRead = gdcm.gdcmHeader(FileName)
-toRead.LoadElements()
+### Get filename from command line or default it
+try:
+   FileName = sys.argv[1]
+except IndexError:
+   FileName = os.path.join(GDCM_DATA_PATH, "test.acr")
+
+if not os.path.isfile(FileName):
+   print "Cannot open file ", FileName
+   sys.exit()
+
+toRead = gdcmHeader(FileName)
 ValDict = toRead.GetPubElVal()
 ExploreElements = ["Patient Name", "Patient ID",
                                                 "Study Date", "Study Time", "Study ID",