]> Creatis software - gdcm.git/blobdiff - Testing/TestAllReadCompareDicom.cxx
Add some more tests
[gdcm.git] / Testing / TestAllReadCompareDicom.cxx
index 0194a97c1314310c259511a50242df061efd1654..d2fb988f5087435919ae0942aed0b78e8483141d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestAllReadCompareDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/31 03:36:59 $
-  Version:   $Revision: 1.26 $
+  Date:      $Date: 2005/02/03 10:00:06 $
+  Version:   $Revision: 1.30 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -15,6 +15,7 @@
      PURPOSE.  See the above copyright notices for more information.
                                                                                 
 =========================================================================*/
+#include "gdcmDirList.h"
 #include "gdcmFile.h"
 #include "gdcmFileHelper.h"
 
 //Generated file:
 #include "gdcmDataImages.h"
 
-int InternalTest(std::string const & filename, 
-                 std::string const & referenceFileName )
+int InternalTest(std::string const &filename, 
+                 std::string const &referenceFileName )
 {
       std::cout << "   Testing: " << filename << std::endl;
 
       ////// Step 1:
       std::cout << "      1...";
-      gdcm::FileHelpertested = new gdcm::FileHelper( filename );
+      gdcm::FileHelper *tested = new gdcm::FileHelper( filename );
       if( !tested->GetFile()->IsReadable() )
       {
         std::cout << " Failed" << std::endl
@@ -48,7 +49,7 @@ int InternalTest(std::string const & filename,
       std::ifstream testFILE( referenceFileName.c_str() );
       if (! testFILE )
       {
-         uint8_ttestedImageData = tested->GetImageData(); // Kludge
+         uint8_t *testedImageData = tested->GetImageData(); // Kludge
          (void)testedImageData;
 
          tested->SetWriteModeToRGB();
@@ -60,7 +61,7 @@ int InternalTest(std::string const & filename,
       ////// When reference file is not gdcm readable test is failed:
       std::cout << "3a...";
 
-      gdcm::FileHelperreference = new gdcm::FileHelper( referenceFileName );
+      gdcm::FileHelper *reference = new gdcm::FileHelper( referenceFileName );
       if( !reference->GetFile()->IsReadable() )
       {
          std::cout << " Failed" << std::endl
@@ -77,10 +78,10 @@ int InternalTest(std::string const & filename,
       ////// Step 3b:
       std::cout << "3b...";
       int testedDataSize    = tested->GetImageDataSize();
-      uint8_ttestedImageData = tested->GetImageData();
+      uint8_t *testedImageData = tested->GetImageData();
     
       int    referenceDataSize = reference->GetImageDataSize();
-      uint8_treferenceImageData = reference->GetImageData();
+      uint8_t *referenceImageData = reference->GetImageData();
 
       // Test the image size
       if (tested->GetFile()->GetXSize() != reference->GetFile()->GetXSize() ||
@@ -138,7 +139,7 @@ int InternalTest(std::string const & filename,
       return 0;
 }
 
-int TestAllReadCompareDicom(int argc, charargv[]) 
+int TestAllReadCompareDicom(int argc, char *argv[]) 
 {
    if ( argc == 3 )
    {
@@ -196,8 +197,7 @@ int TestAllReadCompareDicom(int argc, char* argv[])
       std::string baseLineDir = GDCM_DATA_ROOT;
       baseLineDir += "/BaselineDicom/";
 
-      std::ifstream testDIR(baseLineDir.c_str(), std::ios::in | std::ios::binary);
-      if (!testDIR )
+      if( !gdcm::DirList::IsDirectory(baseLineDir) )
       {
          std::cerr << "   The reference baseline directory " << std::endl
                    << "      "
@@ -206,7 +206,6 @@ int TestAllReadCompareDicom(int argc, char* argv[])
                    << std::endl;
          return 1;
       }
-      testDIR.close();
 
       ////// Step 1 (see above description):
       std::string filename = GDCM_DATA_ROOT;
@@ -215,7 +214,7 @@ int TestAllReadCompareDicom(int argc, char* argv[])
       
       std::string referenceFileName = baseLineDir + gdcmDataImages[i++];
       std::string::size_type slash_pos = referenceFileName.rfind( "." );
-      if ( slash_pos != std::string::npos )
+      if( slash_pos != std::string::npos )
       {
          referenceFileName.replace( slash_pos + 1, 3, "dcm" );
       }