]> Creatis software - gdcm.git/blobdiff - gdcmPython/demo/PrintFile.py.in
* bug fix in the Python demos, due to the recent changes
[gdcm.git] / gdcmPython / demo / PrintFile.py.in
index ee6bbfe502c22095a5dc48cd1a642118f15f186d..2b3582faf95c4194914de878aa63dc6bbb56dad6 100644 (file)
@@ -26,7 +26,9 @@ except IndexError:
    printLevel = 1
 
 ### Build the file element list
-file = gdcm.File(fileName)
+file = gdcm.File()
+file.SetFileName(fileName)
+file.Load()
 if not file.IsReadable():
    PrintUse()
    raise RuntimeError,"The '%s' file is not readable with gdcm." % fileName
@@ -47,12 +49,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.DataEntryPtr)):
+      print "Data %s [%s] [%s] : %s" % (val.GetKey().str(),val.GetVR().str(),
+                                        val.GetName(),val.GetString())
    val=file.GetNextEntry()
 val=None