]> Creatis software - gdcm.git/blobdiff - gdcmPython/testSuite.py
* src/gdcmValEntry.h: member voidArea type changed from char* to void*.
[gdcm.git] / gdcmPython / testSuite.py
index f43c216dd2422c42a14212d3ca15f175f86c3e9e..3f0ccd3af30485d8498f3ce41108fafa775d77be 100644 (file)
@@ -1,7 +1,10 @@
 import unittest
 import os
 from gdcmPython import *
-from vtkgdcmPython import *
+if os.name == 'posix':
+   from libvtkgdcmPython import *
+else:
+   from vtkgdcmPython import *
 
 class gdcmTestCase(unittest.TestCase):
    # The files whose name starts with a modality (e.g. CR-MONO1-10-chest.dcm)
@@ -23,7 +26,7 @@ class gdcmTestCase(unittest.TestCase):
            ["Manufacturer", "FUJI PHOTO FILM CO. LTD."],
            ["Manufacturer's Model Name", "9000"],
            ["Pixel Data", "gdcm::NotLoaded. Address:776 Length:387200 x(5e880)"]
-                       ] ],
+         ] ],
       ####################################
       # CT modality examples:
       ####################################
@@ -39,7 +42,7 @@ class gdcmTestCase(unittest.TestCase):
            ["Manufacturer", "Picker International, Inc."],
            ["Manufacturer's Model Name", "PQ5000"],
            ["Pixel Data", "gdcm::NotLoaded. Address:1680 Length:524288 x(80000)"]
-                         ] ],
+         ] ],
       ["CT-MONO2-16-ort.dcm",
          [ ["Transfer Syntax UID", "1.2.840.10008.1.2"],  # Implicit VR, LE
            ["Modality", "CT"],
@@ -536,8 +539,11 @@ class gdcmTestCase(unittest.TestCase):
    def _BaseTest(self, FileSet):
       for entry in FileSet:
          fileName = os.path.join(GDCM_TEST_DATA_PATH, entry[0])
-         toRead = gdcmHeader(fileName)
-         valDict = toRead.GetPubElVal()
+         reader = gdcmHeader(fileName)
+         assert reader.IsReadable(),\
+                "File '%s' is not readable by gdcmHeader" % fileName
+
+         valDict = reader.GetEntry()
          for subEntry in entry[1]:
             element = subEntry[0]
             value   = subEntry[1]
@@ -545,7 +551,6 @@ class gdcmTestCase(unittest.TestCase):
                              ("Wrong %s for file %s (got %s, shoud be %s)"
                              % (element,fileName, valDict[element], value)) )
 
-
    def testBarre(self):
       gdcmTestCase._BaseTest(self, gdcmTestCase.BarreFiles)
 
@@ -558,7 +563,7 @@ class gdcmTestCase(unittest.TestCase):
    def testJpeg(self):
       gdcmTestCase._BaseTest(self, gdcmTestCase.GdcmJpegFiles)
 
-   def testWrite(self):
+   def ZOBtestWrite(self):
       import md5
       SourceFileName = os.path.join(GDCM_TEST_DATA_PATH,
                                     'gdcm-MR-PHILIPS-16-Multi-Seq.dcm')
@@ -566,8 +571,8 @@ class gdcmTestCase(unittest.TestCase):
       Source.GetImageData()
       TargetFileName = "junk"
       Target = Source.WriteDcmImplVR(TargetFileName)
-      # Sign = 'c3d27238647b7eaa773bff6ea0692b54' # old signature in the file
-      Sign = 'a1e2abdc2f6abedd86b93c8b88db5203' # new signature (found on Win)
+#       Sign = 'a1e2abdc2f6abedd86b93c8b88db5203' # new signature (found on Win)
+      Sign = '849e722e004d3bb37b87ab6006509b8f' # new signature without field strip
       ComputeSign = md5.new(open(TargetFileName).read()).hexdigest()
       self.assertEqual(ComputeSign, Sign,
           ("Wrong signature for file %s (got %s, shoud be %s)"