]> Creatis software - gdcm.git/blobdiff - gdcmPython/demo/PrintFile.py.in
* Amelioration of the Python part concerning demos
[gdcm.git] / gdcmPython / demo / PrintFile.py.in
index 77b1058c973ad20b40e4fd7b1a69f28b7c50dc13..007a3fa1bfc8422f39044e58c2c163d6649c9f78 100644 (file)
@@ -1,15 +1,16 @@
 import sys
-import os
-
-sys.path.append('${GDCM_BINARY_DIR}')
-if os.name == 'posix':
-   sys.path.append('${GDCM_BINARY_DIR}/bin')
-else:
-   sys.path.append('${GDCM_BINARY_DIR}/bin/Release')
-   sys.path.append('${GDCM_BINARY_DIR}/bin/Debug')
-
+from gdcmConfigDemo import *
 from gdcmPython.core import *
 
+def PrintUse():
+   print ""
+   print "Use :"
+   print "-----"
+   print "%s <fileName>" % sys.argv[0]
+   print "   fileName : path to the DICOM file to parse"
+   print ""
+   print ""
+
 ### Get filename from command line or default it
 try:
    fileName = sys.argv[1]
@@ -22,11 +23,12 @@ except IndexError:
    printLevel = 1
 
 ### Build the file element list
-print fileName, type(fileName)
 file = gdcm.File(fileName)
 if not file.IsReadable():
+   PrintUse()
    raise RuntimeError,"The '%s' file is not readable with gdcm." % fileName
 
+print "File -->",fileName
 print "##############################################################"
 print "### Display all the elements and their respective values"
 print "## found in the ", fileName, " file."