]> Creatis software - gdcm.git/blobdiff - Testing/TestAllReadCompareDicom.cxx
* src/gdcmFile.cxx : now delete the PixelConvert instance.
[gdcm.git] / Testing / TestAllReadCompareDicom.cxx
index 2fefb6bd6acd978c5f725a9fc28eaac1085d3db3..21aba424208705a08ec24e223ab2096adaa9f1b2 100644 (file)
@@ -1,5 +1,6 @@
 #include "gdcmHeader.h"
 #include "gdcmFile.h"
+#include <stdio.h>
 
 //Generated file:
 #include "gdcmDataImages.h"
@@ -26,16 +27,13 @@ int InternalTest(std::string const & filename,
       if (! testFILE )
       {
       ////// Step 3a:
-
-         int testedDataSize    = tested->GetImageDataSize();
-         (void)testedDataSize;
-         void* testedImageData = tested->GetImageData(); // Kludge
+         uint8_t* testedImageData = tested->GetImageData(); // Kludge
          tested->WriteDcmExplVR( referenceFileName );
          std::cerr << "      Creating reference baseline file :" << std::endl
                    << "      " << referenceFileName 
                    << std::endl;
          delete tested;
-         delete (char*)testedImageData;
+         //delete (char*)testedImageData;
          return 0;
       }
       else
@@ -59,10 +57,10 @@ int InternalTest(std::string const & filename,
       ////// Step 3b:
 
       int testedDataSize    = tested->GetImageDataSize();
-      void* testedImageData = tested->GetImageData();
+      uint8_t* testedImageData = tested->GetImageData();
     
       int    referenceDataSize = reference->GetImageDataSize();
-      void* referenceImageData = reference->GetImageData();
+      uint8_t* referenceImageData = reference->GetImageData();
 
       if (testedDataSize != referenceDataSize)
       {
@@ -71,8 +69,6 @@ int InternalTest(std::string const & filename,
                    << std::endl;
          delete tested;
          delete reference;
-         delete (char*)testedImageData;
-         delete (char*)referenceImageData;
          return 1;
       }
 
@@ -84,17 +80,14 @@ int InternalTest(std::string const & filename,
                    << std::endl;
          delete tested;
          delete reference;
-         delete (char*)testedImageData;
-         delete (char*)referenceImageData;
          return 1;
       }
-      std::cout << "      Passed." << std::endl ;
+      std::cout << "      Passed..." << std::endl;
 
       //////////////// Clean up:
       delete tested;
       delete reference;
-      delete (char*)testedImageData;
-      delete (char*)referenceImageData;
+      std::cout << "      Passed clean up." << std::endl ;
       
       return 0;
 }
@@ -157,8 +150,8 @@ int TestAllReadCompareDicom(int argc, char* argv[])
       std::string baseLineDir = GDCM_DATA_ROOT;
       baseLineDir += "/BaselineDicom/";
 
-      FILE* testFILE = fopen( baseLineDir.c_str(), "r" );
-      if (!testFILE )
+      std::ifstream* testDIR = new std::ifstream(baseLineDir.c_str(), std::ios::in | std::ios::binary);
+      if (!testDIR )
       {
          std::cerr << "   The reference baseline directory " << std::endl
                    << "      "
@@ -169,11 +162,10 @@ int TestAllReadCompareDicom(int argc, char* argv[])
       }
       else
       {
-         fclose( testFILE );
+         testDIR->close();
       }
 
       ////// Step 1 (see above description):
-
       std::string filename = GDCM_DATA_ROOT;
       filename += "/";
       filename += gdcmDataImages[i];