]> Creatis software - gdcm.git/blobdiff - gdcmPython/demo/PrintFile.py.in
BUG: Apparently python2.5 do not like extension to have a .dll extension, we need...
[gdcm.git] / gdcmPython / demo / PrintFile.py.in
index ee6bbfe502c22095a5dc48cd1a642118f15f186d..7506aef0150dee2f552a7859aca1a5a165f3aef5 100644 (file)
@@ -12,6 +12,12 @@ def PrintUse():
    print ""
    print ""
 
+try:
+   print gdcm.DataEntry
+   print gdcm.DataEntryPtr
+except:
+   pass
+
 ### Get filename from command line or default it
 try:
    fileName = sys.argv[1]
@@ -26,7 +32,9 @@ except IndexError:
    printLevel = 1
 
 ### Build the file element list
-file = gdcm.File(fileName)
+file = gdcm.File.New()
+file.SetFileName(fileName)
+file.Load()
 if not file.IsReadable():
    PrintUse()
    raise RuntimeError,"The '%s' file is not readable with gdcm." % fileName
@@ -47,12 +55,9 @@ val=None
 print "##############################################################"
 val=file.GetFirstEntry()
 while(val):
-   if(isinstance(val,gdcm.ValEntryPtr)):
-      print "Val %04d|%04d [%s] : %s" % (val.GetGroup(),val.GetElement(),
-                                         val.GetName(),val.GetValue())
-   else:
-      print "Bin %04d|%04d [%s] : %s" % (val.GetGroup(),val.GetElement(),
-                                         val.GetName(),val.GetValue())
+   if(isinstance(val,gdcm.DataEntry)):
+      print "Data %s [%s] [%s] : %s" % (val.GetKey().str(),val.GetVR().str(),
+                                        val.GetName(),val.GetString())
    val=file.GetNextEntry()
 val=None